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 Murdoch 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 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

Hi,

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

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