Skip to content

Commit

Permalink
Add support for a list of taggable IDs in the tagging conditions (#1053)
Browse files Browse the repository at this point in the history
  • Loading branch information
moliver-hemasystems authored Nov 9, 2021
1 parent 8548529 commit 52d7dae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Each change should fall into categories that would affect whether the release is

As such, _Breaking Changes_ are major. _Features_ would map to either major or minor. _Fixes_, _Performance_, and _Misc_ are either minor or patch, the difference being kind of fuzzy for the purposes of history. Adding _Documentation_ (including tests) would be patch level.

### [v9.0.0) / 2021-10-19](https://github.com/mbleigh/acts-as-taggable-on/compare/v8.1.0...v9.0.0)
* Features
* [@moliver-hemasystems Add support for a list of taggable IDs in tagging conditions](https://github.com/mbleigh/acts-as-taggable-on/pull/1053)

### [v8.1.0) / 2021-06-19](https://github.com/mbleigh/acts-as-taggable-on/compare/v8.0.0...v8.1.0)
* Fixes
* [@ngouy Fix rollbackable tenant migrations](https://github.com/mbleigh/acts-as-taggable-on/pull/1038)
Expand All @@ -20,13 +24,13 @@ As such, _Breaking Changes_ are major. _Features_ would map to either major or m
* [@lunaru Support tenants for taggings](https://github.com/mbleigh/acts-as-taggable-on/pull/1000)
* Fixes
* [@gr-eg Use none? instead of count.zero?](https://github.com/mbleigh/acts-as-taggable-on/pull/1030)

### [v7.0.0) / 2020-12-31](https://github.com/mbleigh/acts-as-taggable-on/compare/v6.5.0...v7.0.0)
* Features
* [@kvokka Rails 6.1 support](https://github.com/mbleigh/acts-as-taggable-on/pull/1013)
* Fixes
* [@nbulaj Add support for Ruby 2.7 and it's kwargs](https://github.com/mbleigh/acts-as-taggable-on/pull/910)
* [@Andythurlow @endorfin case sensitivity fix for tagged_with](https://github.com/mbleigh/acts-as-taggable-on/pull/965)
* [@nbulaj Add support for Ruby 2.7 and it's kwargs](https://github.com/mbleigh/acts-as-taggable-on/pull/910)
* [@Andythurlow @endorfin case sensitivity fix for tagged_with](https://github.com/mbleigh/acts-as-taggable-on/pull/965)

### [6.5.0 / 2019-11-07](https://github.com/mbleigh/acts-as-taggable-on/compare/v6.0.0...v6.5.0)

Expand Down
9 changes: 8 additions & 1 deletion lib/acts_as_taggable_on/taggable/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ def tagging_conditions(options)

taggable_conditions = sanitize_sql(["#{ActsAsTaggableOn::Tagging.table_name}.taggable_type = ?", base_class.name])
taggable_conditions << sanitize_sql([" AND #{ActsAsTaggableOn::Tagging.table_name}.context = ?", options.delete(:on).to_s]) if options[:on]
taggable_conditions << sanitize_sql([" AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_id = ?", options[:id]]) if options[:id]

if options[:id]
if options[:id].is_a? Array
taggable_conditions << sanitize_sql([" AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_id IN (?)", options[:id]])
else
taggable_conditions << sanitize_sql([" AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_id = ?", options[:id]])
end
end

tagging_conditions.push taggable_conditions

Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_taggable_on/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ActsAsTaggableOn
VERSION = '8.1.0'
VERSION = '9.0.0'
end

0 comments on commit 52d7dae

Please sign in to comment.