Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Small performance improvement for Rails 3, but not as satisfy…

…ing as taking the conditions and joins from the original scope and applying them to a new scope. Haven't found out how to do that in Rails 3.0 yet :("

This reverts commit 9385e17.
  • Loading branch information...
commit 3cf609de1276a270b34e238d0699042921bb43e7 1 parent 1d02ee5
Tom-Eric Gerritsen tomeric authored
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
4 lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
View
@@ -115,9 +115,7 @@ def all_tag_counts(options = {})
if ActiveRecord::VERSION::MAJOR >= 3
# Append the current scope to the scope, because we can't use scope(:find) in RoR 3.0 anymore:
scoped_select = "#{table_name}.#{primary_key}"
- scoped_sql = select(scoped_select).to_sql
-
- tagging_scope = tagging_scope.joins("JOIN (#{scoped_sql}) AS conditional_join ON conditional_join.#{primary_key} = #{ActsAsTaggableOn::Tagging.table_name}.taggable_id").
+ tagging_scope = tagging_scope.where("#{ActsAsTaggableOn::Tagging.table_name}.taggable_id IN(#{select(scoped_select).to_sql})").
group(group_columns).
having(having)
else
Please sign in to comment.
Something went wrong with that request. Please try again.