I want to add a method to the Array class in a rails app. Where should I put this method?
EDIT to be clearer, obviously I put it in a file somewhere, but how do I tell the rails app about where to find it?
rubyruby-on-rails
I want to add a method to the Array class in a rails app. Where should I put this method?
EDIT to be clearer, obviously I put it in a file somewhere, but how do I tell the rails app about where to find it?
Best Solution
One way to do this is to create a file at
lib/rails_extensions.rb
. Then, add your extensions like so:Then in
config/environment.rb
, add this:Your mileage with subservient objects may vary.