Have you indexed the foreign key field? If so just add a FieldQuery to the end
of your query.
For example if your foreign key field is "book_id" and you only want
records with a "book_id" of 3 you''d add "book_id:3"
to the end of your query. Or perhaps you want a range of "book_ids",
you should be able to do "book_id:[3 9]" to find all records with a
foreign key field of "book_id" between 3 and 9.
Good resources are the following sites:
http://ferret.davebalmain.com/trac/wiki
http://projects.jkraemer.net/acts_as_ferret/
You can also check out the ferret mailing list:
http://www.ruby-forum.com/forum/5
There''s also some other sites that give examples of using
acts_as_ferret. You just need to google for "acts_as_ferret" to find a
lot of them.
I use the above example in my own project, but it''s not a foreign key
field; instead, I''m using a table with STI and I scope the results
based on the inheritance column.
Hope that helps,
Curtis
----- Original Message -----
From: blinking bear
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Sent: Wednesday, November 15, 2006 10:43 PM
Subject: [Rails] Scoping acts_as_ferret
I have acts_as_ferret up and running but I need to scope it so that it only
returns records from a table with a certain foreig key. Anyone have a good
resource for this?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---