Extending ActiveRecords in Rails 3

I have added a method to the ActiveRecords module and put it in the lib directory like so:

module ActiveRecord

  class Base     def self.my_search(search, current_page, search_field, user_role, perms)       ...     end   end end

This method has worked flawlessly in Rails 2.3.x and still works fine. But Rails 3 refuses to find it. This is in-spite of executing the following statement in config/application.rb file of Rails 3:

    # Custom directories with classes and modules you want to be autoloadable.     config.autoload_paths += %W(#{Rails.root}/lib)

What am I doing wrong?



Problem solved. Moved the file into:

Rails.root/config/initializers directory and it worked.