Skip to content

Instantly share code, notes, and snippets.

@ddellacosta
Created April 27, 2011 04:46
Show Gist options
  • Save ddellacosta/943731 to your computer and use it in GitHub Desktop.
Save ddellacosta/943731 to your computer and use it in GitHub Desktop.
Why the heck isn't acts_as_taggable_on working in this model?
#### Rails console ####
irb(main):091:0> @doc.tag_list
=> []
irb(main):092:0> @doc.tag_list = "one, two, three"
=> "one, two, three"
irb(main):093:0> @doc.save!
=> true
irb(main):094:0> @doc.tag_list
=> []
irb(main):095:0> ActsAsTaggableOn::Tag.named("one")
=> []
irb(main):096:0> ActsAsTaggableOn::Tag.named("two")
=> []
irb(main):097:0> ActsAsTaggableOn::Tag.named("three")
=> []
irb(main):098:0> ActsAsTaggableOn::Tag.find_or_create_with_like_by_name("one")
=> #<ActsAsTaggableOn::Tag id: 1, name: "one">
irb(main):099:0> ActsAsTaggableOn::Tag.named("one")
=> [#<ActsAsTaggableOn::Tag id: 1, name: "one">]
irb(main):100:0>
#### Class ####
class Document < ActiveRecord::Base
acts_as_taggable
attr_accessible :tag_list
<snip>
end
# Gemfile
gem 'rails', '3.0.5'
gem 'acts-as-taggable-on'
<snip>
# &*$(%#$??!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment