Allowing only one tag per post

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.

I found this code in another post:

clean string to remove spaces and force lowercase

def self.clean_string(string)
(string.downcase).gsub(" “,”")
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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs