Reputation: 1837
If I do something simple like
class Object
def itworks
"hoorah"
end
end
and add this to lib/ I can't see any effect in the rails console. i.e "".itworks gives a method missing. Where is the proper place to add things like this.
Upvotes: 0
Views: 62
Reputation: 115511
the very same question was asked today; you need to load everything in lib.
Be sure to understand the difference between require
and autoload
Upvotes: 2
Reputation: 7288
you can put this file in config\initializers, rails will load it in any environment.
Upvotes: 1
Reputation: 17960
You'll need to require it from somewhere that is loaded in your Rails app. A good place for this could be in config/application.rb if you want it to be used in all your configurations:
require "lib/my_helpers"
Upvotes: 2