Rails - why would a model inside RAILS_ROOT/lib not be available in production mode?

Posted by sa125 on Stack Overflow See other posts from Stack Overflow or by sa125
Published on 2010-05-20T09:26:54Z Indexed on 2010/05/20 9:40 UTC
Read the original article Hit count: 352

Hi -

I have a class located inside RAILS_ROOT/lib folder, which I use in one of my helpers, and it works great in development.

When I switch to production, the application throws a NameError (uninitialized constant SomeHelper::SomeClass), and I have to load it manually in the helper:

load "#{Rails.root}/lib/some_class.rb"

module SomeHelper
  def some_method
    sc = SomeClass.new
    # blah
  end
end

I was under the impression that everything inside RAILS_ROOT/lib/* should be available all to the app - is there anything I need to configure to make this happen in prod mode? thanks.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about production-environment