Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

we should apply the default scope before querying

  • Loading branch information...
commit d7e23109136733995bfadbe461ae18680a7426b5 1 parent 9fc574f
@tenderlove tenderlove authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  activerecord/lib/active_record/relation/finder_methods.rb
View
3  activerecord/lib/active_record/relation/finder_methods.rb
@@ -172,7 +172,8 @@ def exists?(conditions = :none)
relation = relation.where(table[primary_key].eq(conditions)) if conditions != :none
end
- connection.select_value(relation, "#{name} Exists", relation.bind_values)
+ relation = relation.with_default_scope
+ connection.select_value(relation.arel, "#{name} Exists", relation.bind_values)
end
# This method is called whenever no records are found with either a single
Please sign in to comment.
Something went wrong with that request. Please try again.