Skip to content

Commit

Permalink
fetch ids without instantiating records by using pluck
Browse files Browse the repository at this point in the history
  • Loading branch information
ashanbrown committed Aug 29, 2014
1 parent 6f43756 commit 9616b3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ As such, a _Feature_ would map to either major or minor. A _bug fix_ to a patch.
* Performance
* Misc

### [3.4.0 / 2014-08-29](Master [changes](https://github.com/mbleigh/acts-as-taggable-on/compare/v3.3.0...v3.4.0)
### [3.4.0 / 2014-08-29](https://github.com/mbleigh/acts-as-taggable-on/compare/v3.3.0...v3.4.0)

* Features
* [@ProGM Support for custom parsers for tags](https://github.com/mbleigh/acts-as-taggable-on/pull/579)
* [@damzcodes #577 Popular feature](https://github.com/mbleigh/acts-as-taggable-on/pull/577)
* Fixes
* [@twalpole Update for rails edge (4.2)]
* Performance
* [@dontfidget #587 Use pluck instead of select](https://github.com/mbleigh/acts-as-taggable-on/pull/587)

### [3.3.0 / 2014-07-08](https://github.com/mbleigh/acts-as-taggable-on/compare/v3.2.6...v3.3.0)

Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_taggable_on/taggable/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def generate_tagging_scope_in_clause(tagging_scope, table_name, primary_key)
table_name_pkey = "#{table_name}.#{primary_key}"
if ActsAsTaggableOn::Utils.using_mysql?
# See https://github.com/mbleigh/acts-as-taggable-on/pull/457 for details
scoped_ids = select(table_name_pkey).map(&:id)
scoped_ids = pluck(table_name_pkey)
tagging_scope = tagging_scope.where("#{ActsAsTaggableOn::Tagging.table_name}.taggable_id IN (?)", scoped_ids)
else
tagging_scope = tagging_scope.where("#{ActsAsTaggableOn::Tagging.table_name}.taggable_id IN(#{safe_to_sql(select(table_name_pkey))})")
Expand Down

0 comments on commit 9616b3f

Please sign in to comment.