# Allowing only one tag per post

**URL:** <https://www.ruby-forum.com/t/allowing-only-one-tag-per-post/167229>\
**Category:** Rails\
**Created:** [May 5, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/allowing-only-one-tag-per-post/167229 "2009-05-05T18:33:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbnnt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@bbnnt](https://www.ruby-forum.com/u/bbnnt)\
**Post date:** [May 5, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/allowing-only-one-tag-per-post/167229/1 "2009-05-05T18:33:30Z")

</div>

I’m using acts\_as\_taggable\_on\_steroids to add a tag to a post. For my  
purposes, I only want to allow one tag per post. I’ve looked through the  
acts\_as\_taggable\_on\_steroids code and can’t really put a finger on where  
I should even start. I guess I could do this in a number of ways. I  
could modify input on the tag\_list form (of the post create action) or  
edit the plugin directly. I think modifying the input from the form  
would be best, but I’m not sure. It might be easier to modify  
acts\_as\_taggable\_on\_steroids instead.  
So basically if the input has a comma in it it separates the string into  
two tags. So I somehow need to get it to ignore the commas. Does anyone  
know how I should go about this? Any advice or code would be greatly  
appreciated. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bbnnt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@bbnnt](https://www.ruby-forum.com/u/bbnnt)\
**Post date:** [May 6, 2009, 6:31pm UTC](https://www.ruby-forum.com/t/allowing-only-one-tag-per-post/167229/2 "2009-05-06T18:31:12Z")

</div>

I found this code in another post:

# clean string to remove spaces and force lowercase

def self.clean\_string(string)  
(string.downcase).gsub(" “,”")  
end  
My form:  
\<% form\_for @post, :html =\> { :multipart =\> true } do |f| %\>  
#…  
\<%= f.label ‘Topic’ %\>  
  
\<%= f.text\_field :tag\_list %\>  
#…  
\<% end %\>  
I could use something like this in a callback to remove commas from the  
input on the text\_field correct?
