Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created February 17, 2012 17:37
Show Gist options
  • Save levinotik/1854531 to your computer and use it in GitHub Desktop.
Save levinotik/1854531 to your computer and use it in GitHub Desktop.
class Idea < ActiveRecord::Base
attr_accessible :title, :note
has_and_belongs_to_many :tags
def tags_attributes(hash)
hash.each do |sequence, tag_values|
tags.find_or_create_by_name(tag_values[:name])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment