Title: acts-as-taggable-on use kind of scope (tagger?) and context
Tags: ruby-on-rails;acts-as-taggable-on
Question: My Application uses acts-as-taggable-on to tag ```Content```. The content ```belongs_to``` a ```Company```.

Now all created tags should belong to the used company and not be visible to other companies.

How can i solve this with acts-as-taggable-on? As context i currently use ```:content```. Is in my case the company the Tagger (owner)?

Thanks for clarification.


Here is the accepted answer: I solved it by declaring ```Company``` as the tagger.

```class Company < ApplicationRecord
  acts_as_tagger
end
```

Controller action looks like the following:

```def create
  if params[:content].has_key?(:content_tag_list)
    content_tag_list = params[:content][:content_tag_list]
    params[:content].delete(:content_tag_list)
  end

  @content = Content.new(content_params)
  if @content.save
    if content_tag_list
      @content.company.tag(@content, with: content_tag_list, on: :content_tags)
    end
    redirect_back fallback_location: your_path
  else
    render :new
  end
end
```



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:07/30/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<ruby-on-rails><acts-as-taggable-on>', 'Title': 'acts-as-taggable-on use kind of scope (tagger?) and context', 'ViewCount': 130, 'id': 51600756, 'user_AboutMe': '', 'user_AccountId': 463025.0, 'user_DisplayName': 'Oliver', 'user_Reputation': 769.0, 'user_Views': 83.0, 'user_id': 865678.0}}