How to search an item using tags and an integer value?


#1

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