Skip to content

Instantly share code, notes, and snippets.

@ddellacosta
Created November 23, 2010 18:11
Show Gist options
  • Save ddellacosta/712223 to your computer and use it in GitHub Desktop.
Save ddellacosta/712223 to your computer and use it in GitHub Desktop.
Rails 3.0.1 + acts_as_taggable_on 2.0.6
links-tag-test $ bundle exec rails console
Loading development environment (Rails 3.0.1)
irb(main):001:0> @link1 = Link.create(:name => 'google', :link => 'http://google.com', :description => 'google', :tag_list => 'tag1, tag2, tag3')
=> #<Link id: 12, name: "google", description: "google", link: "http://google.com", created_at: "2010-11-23 18:09:37", updated_at: "2010-11-23 18:09:37", user_id: nil>
irb(main):002:0> @link1.is_taggable?
=> true
irb(main):003:0> @link1.tag_list
=> []
irb(main):004:0> @link2 = Link.new(:name => 'yahoo', :link => 'http://yahoo.com', :description => 'yahoo')
=> #<Link id: nil, name: "yahoo", description: "yahoo", link: "http://yahoo.com", created_at: nil, updated_at: nil, user_id: nil>
irb(main):005:0> @link2.valid?
=> true
irb(main):006:0> @link2.tag_list = 'tag1, tag2, tag3'
=> "tag1, tag2, tag3"
irb(main):007:0> @link2.save
=> true
irb(main):008:0> @link2.tag_list
=> ["tag1", "tag2", "tag3"]
irb(main):009:0> @link1.tag_list
=> []
irb(main):010:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment