Reputation: 21
I recently upgraded my rails app from Thin to Puma, hosted on Heroku. Everything works perfectly on staging environment, but when I deploy to production no modules or classes seem to be loaded.
The app launches and run on production but whenever one of the classes in my /lib
directory is needed I get a NameError
(uninitialized constant) error.
In my application.rb
file this is where I load the lib files:
config.autoload_paths += Dir["#{config.root}/lib", "#{config.root}/lib/**/"]
Running Rails 3.1.1 and Ruby 2.1.1
I can't work out why they would load in staging but not production. Any help would be much appreciated!
Upvotes: 2
Views: 201
Reputation: 29
You should try add those line to application.rb:
config.eager_load_paths << Rails.root.join('lib')
config.autoload_paths << Rails.root.join('lib')
It worked for me
Upvotes: 1