Bhushan Lodha
Bhushan Lodha

Reputation: 6862

Make folder/scripts autoloadable in rails 3

I have downloaded a gem and cuztomized few of its methods and placed it in scripts folder. How do I auto load those scripts instead of requiring them in every controller/other scripts that I need.

Upvotes: 0

Views: 90

Answers (1)

Syed Aslam
Syed Aslam

Reputation: 8807

lib folder is the place to put those files. Then you should edit your config/application.rb file to configure auto load paths like this:

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

Upvotes: 1

Related Questions