Ruby on Rails 3 RC and files in "lib" directory

In Rails 3b4 my ruby files in the lib directory of my application were
automaticaly loaded/required.

In Rails 3rc1, there are not anymore. Is this normal?

Where is the commit that changed this?
What is the best prefered way to load the files in “lib”?

Thanks for your answers.

Nicolas.

sam problem here :frowning:

anyone know?

I get:

uninitialized constant ApplicationController::Authentication

Obviously I could just move the methods from my lib/authentication.rb
file into application_controller.rb but I’d prefer to see if there’s
another way first…

Steve M. wrote:

sam problem here :frowning:

anyone know?

I get:

uninitialized constant ApplicationController::Authentication

Obviously I could just move the methods from my lib/authentication.rb
file into application_controller.rb but I’d prefer to see if there’s
another way first…

Of course it’s still possible to require manually files in “lib” but
wanna know if that’s a feature, not a bug :).

Hi,

Ading
config.autoload_paths += %W(#{config.root}/lib)

to my application file solved it :slight_smile:
Thank you so much

On Jul 27, 5:59 am, stephenjamesmurdoch

Hi Nicolas, i think I’ve fixed the problem…

add the following to your application.rb file:

# Custom directories with classes and modules you want to be

autoloadable.
config.autoload_paths += %W(#{config.root}/lib)

This code is generated when you create a brand new rails3rc app but
not when you create a rails3b4 one…

Also, in your rakefile, change:

Rails::Application.load_tasks

to
YourAppName::Application.load_tasks

I could be wrong but I think it’s fixed the problem for me…

Cheers
Steve

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs