Hi,
I would like to know where put monkey patching code like the following in my rails application which would open up existing classes and add or override new functionality. I want this code to be available to all instances as soon as possible. Is autoload the correct way of doing this and putting the call in environment.rb?
class Class
def attr_initializer(*attributes)
attr_reader *attributes
class_eval <<-RUBY
def initialize(#{attributes.join(', ')})
#{attributes.map{ |attribute| "@#{attribute}" }.join(', ')} = #{attributes.join(', ')}
end
RUBY
end
end