I have a pretty simple HABTM set of models
class Tag < ActiveRecord::Base has_and_belongs_to_many :posts end class Post < ActiveRecord::Base
You should add an index on the tag :name property and then use the find_or_create method in the Tags#create method
docs