Reputation: 323
I have setup the acts-as-taggable-on gem on Rails 3.0.3 and Ruby 1.9.2. The tagging is working as expected but the taggings table is not capturing the tagger_id.
Here is what I have setup:
class Course < ActiveRecord::Base
# attr_accessible :title, :description, :duration, :format
acts_as_taggable
class User < ActiveRecord::Base
# identifies user who tags as part of the acts-as-taggable-on gem
acts_as_tagger
Thanks in advance for any help identifying what I am missing.
Upvotes: 3
Views: 793
Reputation: 2821
Acts-as-taggable-on has no way to automatically know which user is doing the tagging. When a user enters or edits a Course, in the controller you have to explicitly tell it that the user is tagging the class as follows:
@user.tag(@class, :with => "tag1, tag2")
It's in the documentation under the heading Tag Ownership:
https://github.com/mbleigh/acts-as-taggable-on
Upvotes: 2