# Split tag from acts\_as\_taggable\_on\_steroids

**URL:** <https://www.ruby-forum.com/t/split-tag-from-acts-as-taggable-on-steroids/115209>\
**Category:** Rails\
**Created:** [September 21, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/split-tag-from-acts-as-taggable-on-steroids/115209 "2007-09-21T19:14:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peninha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a698b9/32.png) [@peninha](https://www.ruby-forum.com/u/peninha)\
**Post date:** [September 21, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/split-tag-from-acts-as-taggable-on-steroids/115209/1 "2007-09-21T19:14:34Z")

</div>

Hi,

I have set up acts\_as\_taggable\_on\_steroids and it works great. But I’m  
having trouble spliting the tag\_list string to generate individual  
links for each tag.

I’m getting the data in my controller:

@dishes = Dish.find\_tagged\_with(params[:tag])

then in my view I do this:

\<%  
tags = dish.tag\_list.split  
for tag in tags %\>  
\<%= link\_to tag, :controller=\> ‘dish’,  
:action =\> ‘search\_dish\_by\_tag’,  
:tag =\> tag %\>  
\<% end %\>

This works for single words but it’s also splitting the words enclosed  
in single cotes. So if I have a tag like ‘noodle soup’ it’d generate 2  
links ‘noodle and soup’. Do I have to use a reg. expression here or  
there’s an easier way to do this?

thanks in advance,

Mauricio

---

<div class="post-metadata">

**Author:** ![peninha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a698b9/32.png) [@peninha](https://www.ruby-forum.com/u/peninha)\
**Post date:** [September 22, 2007, 3:04am UTC](https://www.ruby-forum.com/t/split-tag-from-acts-as-taggable-on-steroids/115209/2 "2007-09-22T03:04:12Z")

</div>

dish.tag\_list.each do |tag|  
end

-Jonathan.
