This forum is an extremely valuable resource! Thanks to everyone who has
contributed, especially Jens and Dave. I hope I’ll be able to give
back to the community soon!
I have a model, ‘Book’, that has associations to several other models,
comments, tags, authors, etc… I have implemented acts_as_ferret to
the Book model and the associations as follows:
class Book < ActiveRecord::Base
has_many :authors etc…
acts as ferret implementation
acts_as_ferret :fields => [:title, :tag_list, :comments_list,
:details_value_list, :details_title_list, :author_names]
def details_value_list return self.details.collect do |detail| detail.value end.join(",") end def details_title_list return self.details.collect do |detail| detail.title end.join(",") end def details_text return self.details.collect do |detail| detail.text_title + detail.text_value end.join(",") end def author_names return self.authors.collect do |authors| authors.name end.join (",") end
I can successfully search the Book model and all of its associations.
I would like to print out in which field/association the hit occurred.
example, I would like to print to the user whether the hit was in the
title, a tag, in a comment or in the collection of authors, as I am only
printing the title of the book and some higher level details in the
Does anyone have suggestions? I have scoured the internet to no
avail…maybe I am not searching with the right terms?
Thank you kindly for any help,