aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-06-12 11:47:02 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-06-12 11:51:26 -0700
commitd7e23109136733995bfadbe461ae18680a7426b5 (patch)
tree85c2afec0811f1f57de25830da99f7cf8d6bb895 /activerecord/lib/active_record
parent9fc574fdea359963679e2385e04c23ff007f25e9 (diff)
downloadrails-d7e23109136733995bfadbe461ae18680a7426b5.tar.gz
rails-d7e23109136733995bfadbe461ae18680a7426b5.tar.bz2
rails-d7e23109136733995bfadbe461ae18680a7426b5.zip
we should apply the default scope before querying
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index f0edef58bf..cbb2803593 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -172,7 +172,8 @@ module ActiveRecord
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