Silly question, how do I expand (add a function to) Active Record for
all of my models?
Mindtonic wrote:
Silly question, how do I expand (add a function to) Active Record for
all of my models?
Depends on where in Active Record you want to extend it.
In a nutshell, you just create a new module and include it in
ActiveRecord.
–
Robby R.
http://www.robbyonrails.com # my blog
http://www.planetargon.com # my business
http://www.programmingrails.com # my book
I am wanting to add the self.full_text_search for Ferret in a way that
I only have to put it in one place and not in every single model that
I want to be able to search. That would be a lot of repeating
myself! Thanks…
On Sep 5, 6:15 am, Mindtonic [email protected] wrote:
I am wanting to add the self.full_text_search for Ferret in a way that
I only have to put it in one place and not in every single model that
I want to be able to search. That would be a lot of repeating
myself! Thanks…
I think you could have a subclass of AR::Base that acts_as_ferret and
then your models subclass that, but then you index every column of
every table (?!)