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?

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: [email protected]
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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs