On Tue, Dec 12, 2006 at 12:51:28AM +0100, koloa wrote:
> hi,
> i have this in my code
> 
> Article.find_by_contents("#{searchstring} +city:#{passedincity}")
> 
> well that returns to me only articles that belong to whatever the user
> selected in city.
> 
> now is it possible to search the grandparent?
> 
> for example
> 
> class country
> has_many states
> 
> class states
> has_many cities
> belongs_to country
> 
> class city
> belongs_to states
> 
> ......
> 
> i would like to search articles that only belong to a country.
> something like...
> Article.find_by_contents("#{searchstring}
> +states.country:#{passedincountry}")

you'll have to index state and country whith each article, through
indexed methods. there are plenty of examples of how to do this in the 
archives.

Jens


-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to