You need to return what you want ferret to return to you when a search
is made.
The search results will return all books that contain the name of the
author, or authors. You could have a author_name as such,
def author_names
search_string = ""
authors = Authors.find_all_by_book(self)
authors.each do | author |
search_string << author.name << " "
end
search_string
end
You put this in the field to search and ferret will happily index it.
Serge Chevarie-Pelletier
tresero wrote:> I was wondering if anyone had used ferret with an habtm relation?
>
> Say you have books and authors
> books habtm authors
> authors habtm books
>
> join table would be authors_books
>
> I know in a 1 => m you can:
> acts_as_ferret :fields => [:title, :author_name] on books
> but how would you do something similar with the habtm?
>
> Jon
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---