Re: Adding a method to ActiveRecord.

Vishnu Gopal
Mon, 02 Oct 2006 15:23:44 -0000

There is (also) a toggle on ActiveRecord which is really useful.

http://ar.rubyonrails.com/classes/ActiveRecord/Base.html#M000399

Vish

On 10/2/06, Xavier Noria <fxn-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org>
wrote:
>
>
> On Oct 2, 2006, at 7:40 AM, Sam Donaldson wrote:
>
> > Hi, I''d like to add a generic function to all my models.
Basically a
> > function that will handle setting/unsetting flags in various
> > models.  Is
> > there a way I could add this to ActiveRecord''s Base class and
then use
> > it all throughout my models?  Where could I add this and how?
>
> Just subclass ActiveRecord::Base:
>
>    class MyBaseExtension < ActiveRecord::Base
>      self.abstract_class = true
>      # ...
>    end
>
> and then make all models inherit from MyBaseExtension.
>
> -- fxn
>
>
>
>
> >
>