Skip to content

Commit

Permalink
Support array of contexts in owner_tags_on method
Browse files Browse the repository at this point in the history
  • Loading branch information
Divya Kunnath authored and Divya Kunnath committed Jul 21, 2016
1 parent eac05e9 commit c423d01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/acts_as_taggable_on/taggable/ownership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def owner_tags(owner)
scope = base_tags
else
scope = base_tags.where(
"#{ActsAsTaggableOn::Tagging.table_name}": {
"#{ActsAsTaggableOn::Tagging.table_name}".to_sym => {
tagger_id: owner.id,
tagger_type: owner.class.base_class.to_s
}
Expand All @@ -49,7 +49,11 @@ def owner_tags(owner)
end

def owner_tags_on(owner, context)
scope = owner_tags(owner).where([%(#{ActsAsTaggableOn::Tagging.table_name}.context = ?), context.to_s])
scope = owner_tags(owner).where(
"#{ActsAsTaggableOn::Tagging.table_name}".to_sym => {
context: context
}
)
end

def cached_owned_tag_list_on(context)
Expand Down

0 comments on commit c423d01

Please sign in to comment.