# Acts\_as\_taggable help

**URL:** <https://www.ruby-forum.com/t/acts-as-taggable-help/59143>\
**Category:** Rails\
**Created:** [April 29, 2006, 1:32am UTC](https://www.ruby-forum.com/t/acts-as-taggable-help/59143 "2006-04-29T01:32:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [April 29, 2006, 1:32am UTC](https://www.ruby-forum.com/t/acts-as-taggable-help/59143/1 "2006-04-29T01:32:19Z")

</div>

Ahoy, having a bit of difficulty w/ the acts as taggable GEM.  
I was able to create a tagcloud, but now i want to filter items by tags.

in my controller i have

def show\_tagged\_with  
\<-- snip snip --\>  
@items = Item.find\_tagged\_with( :any =\> params[:tag\_name])  
@categories = Category.find\_all  
@tag\_name = params[:tag\_name]  
@tagged\_items = Item.tags\_count(:limit =\> 100)  
end

IN the VIEW  
\<% @items.each do |item| %\>  
\<%= render :partial =\> ‘list\_stripes’, :locals =\> { :item =\> item } %\>  
\<% end %\>

Where the partial \_list\_stripes.rthml is a list of items

```
<td><%=h item.tag_names.join(" ") %></td>
<td><%=h item.created_on %></td>
<td><%=h item.category.name %></td>

```

But i get an error

“undefined method `tag\_names’ for #Array:0x3673b08”

any ideas?

---

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [April 29, 2006, 3:01am UTC](https://www.ruby-forum.com/t/acts-as-taggable-help/59143/2 "2006-04-29T03:01:57Z")

</div>

Example of what works. Convert for your needs.

in tags\_controller.rb

def info  
@name = params[:name]  
@tag = Tag.find(:first, :conditions =\> “name = ‘#{@name}’”)  
end

in info.rhtml  
\<% for @item in @tag.tagged %\>  
\<%= render :partial =\> “render\_item” %\>  
\<% end %\>

in the partial \_render\_item.rhtml  
  
\<%= @ item.name -%\>  
  
\<%= @ item.description -%\>

On 4/28/06, will [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> @tag_name = params[:tag_name]
> 
> ```
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–
