Skip to content

Instantly share code, notes, and snippets.

@peschkaj
Created October 2, 2010 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peschkaj/608020 to your computer and use it in GitHub Desktop.
Save peschkaj/608020 to your computer and use it in GitHub Desktop.
tags.each { |tag| tag_list << Tag.first_or_create(:name => tag.strip) }
tags.each do |tag|
tag.strip!
tag_object = Tag.find_by_name(tag)
tag_object = Tag.create!(:name => tag) if tag_object.nil?
tag_list << tag_object
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment