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

**URL:** <https://www.ruby-forum.com/t/how-to-search-an-item-using-tags-and-an-integer-value/169600>\
**Category:** Rails\
**Created:** [June 5, 2009, 8:05pm UTC](https://www.ruby-forum.com/t/how-to-search-an-item-using-tags-and-an-integer-value/169600 "2009-06-05T20:05:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aupayo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@aupayo](https://www.ruby-forum.com/u/aupayo)\
**Post date:** [June 5, 2009, 8:05pm UTC](https://www.ruby-forum.com/t/how-to-search-an-item-using-tags-and-an-integer-value/169600/1 "2009-06-05T20:05:36Z")

</div>

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
