Forum: Ruby on Rails how to search an item using tags and an integer value?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F049c2111d63441769be5c639d61cd0e?d=identicon&s=25 aupayo (Guest)
on 2009-06-05 20:05
(Received via mailing list)
Hello,

I'm trying to perform a search into some items, those items have tags
and some integer values.

The problem is that I don't know how can I easily develope a search
using both criteria: the tags and an integer value.

For example, imagine that I have an Item with the tags: "red, car" and
the integer value is "1000".
Thanks to the acts_as_taggable_on plugin, I can use the
"find_tagged_with" helper to find this item trough its tags.
Also I can implement an "Item.find(:all, :conditions => "integer =
1000")" in order to find it through its integer value.
But, how can I find it using both criteria (tags and integer values)??

I guess that an option would be implementing my own SQL sentence
including all the search criteria that I need, but I have taken a look
to the source code of the plugin, and it does not seem very easy to
implement for an unexperienced guy in SQL...so if it is possible I
would like to use the "find_tagged_with" helper. Any idea about how
can I combine it with the integer search?

Thank you very much in advance for your help.

Cristóbal
This topic is locked and can not be replied to.