Act_taggable_on does not write tagger_id or tagger_type

I installed the act-as-taggable shortcut on Rails 3.0.3 and Ruby 1.9.2. The tagging works as expected, but the taggings table does not capture tagger_id.

Here is what I installed:

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 in determining what I am missing.

+3
source share
1 answer

Acts-as-taggable-on does not automatically know which user is tagging. When a user enters or edits a course, in the controller you must explicitly tell him that the user marks the class as follows:

@ user.tag (@class ,: with => "tag1, tag2")

This is in the documentation under the heading "Tag Ownership":

https://github.com/mbleigh/acts-as-taggable-on

+2

Source: https://habr.com/ru/post/1776798/


All Articles