On Wed, Jun 13, 2012 at 5:38 PM, Christopher J. Bottaro < [email protected]> wrote:
I just need a point in the right direction to get my foot in the door.
Thanks.
Ryan B. showed how to do all that in a recent pro Railscast.
Take a look at this code from squeel that add methods to active record
relations.
look at lines with ActiveRecord::Relation.send :include, module_methods
you
can load your methods into ActiveRecord::Relation with an initializer
like
this
ActiveSupport.on_load :active_record do
ActiveRecord::Relation.send(:include, your_module)end
is nice how the styling got copied too for the code snippets. XD
On Wed, Jun 13, 2012 at 5:38 PM, Christopher J. Bottaro < [email protected]> wrote:
Take a look at this code from squeel that add methods to active record
relations.
Awesome, thanks! Heh, since posting though, I just opened up the
activerecord gem and figured it out. Here’s how I did it: