diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-06-12 11:47:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-06-12 11:51:26 -0700 |
commit | d7e23109136733995bfadbe461ae18680a7426b5 (patch) | |
tree | 85c2afec0811f1f57de25830da99f7cf8d6bb895 /activerecord/lib/active_record | |
parent | 9fc574fdea359963679e2385e04c23ff007f25e9 (diff) | |
download | rails-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.rb | 3 |
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 |