Silly question, how do I expand (add a function to) Active Record for all of my models? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Russell http://www.robbyonrails.com # my blog http://www.planetargon.com # my business http://www.programmingrails.com # my book --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 4, 7:54 pm, Robby Russell <robby.li...-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> 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 Russellhttp://www.robbyonrails.com # my bloghttp://www.planetargon.com # my businesshttp://www.programmingrails.com # my book--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sep 5, 6:15 am, Mindtonic <mindto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 (?!) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---