-1

When trying to run rails s getting the error as shown in figure

undefined local variable or methode 'config' for main:Object (NameError)

My application.rb file :

require File.expand_path('../boot', __FILE__)

require 'rails/all'
config.assets.paths << Rails.root.join("app", "assets", "fonts")
Farhan Afzal
  • 149
  • 1
  • 2
  • 9

1 Answers1

0

Assuming you're running 3.x (or probably 4.x, but i don't know if it changed in fourth revision of RoR) you need to write something like this:

module RailsApp
  class Application < Rails::Application
    config.assets.paths << Rails.root.join("app", "assets", "fonts")
  end
end

In Rails 2.x it w'd be:

Rails::Initializer.run do |config|
  config.assets.paths << Rails.root.join("app", "assets", "fonts")
end

That's of course only relevan part of the file, you should also include all other parts, but above code (or rather lack of it) is the cause of your problem.

zrl3dx
  • 7,699
  • 3
  • 25
  • 35