Hi,
I have a class with some polymorphic associations to it. I want to use
acts_as_ferret to index my objects and its associations. I want to do
it in a way I can define the fields from the associations to be
indexed in the association class.
I know I could do something like:
acts_as_ferret :fields => [:title, :body, :author_name]
has_one :author
def author_name
author.name
end
but since the relationship is polymorphic it woul be like
acts_as_ferret :fields => [:title, :body, :extra_field]
belongs_to :extra, :polymorphic=>true
def extra_field
case self.extra_type
when ''x''
x.name
when ''y''
y.date
end
what is very ugly and realy not DRY. How can I define in the foreing
class the fields to be indexed?
thanks for any answers! acts_as_ferret seems to be very nice, but I
fell it lacks some docs.
Bruno
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---