aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb8
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb2
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index d197bfe946..256a7e839f 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -452,8 +452,8 @@ module ActiveRecord
#
# If the condition is any other blank-ish object than nil, then where is a # no-op and returns
# the current relation.
- def where(opts = nil, *rest)
- if opts.nil?
+ def where(opts = :chain, *rest)
+ if opts == :chain
WhereChain.new(spawn)
elsif opts.blank?
self
@@ -464,8 +464,8 @@ module ActiveRecord
# #where! is identical to #where, except that instead of returning a new relation, it adds
# the condition to the existing relation.
- def where!(opts = nil, *rest) # :nodoc:
- if opts.nil?
+ def where!(opts = :chain, *rest) # :nodoc:
+ if opts == :chain
WhereChain.new(self)
else
references!(PredicateBuilder.references(opts)) if Hash === opts
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index e8cc6558ca..d25aca760f 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -299,7 +299,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
end
def test_find_with_blank_conditions
- [[], {}, ""].each do |blank|
+ [[], {}, nil, ""].each do |blank|
assert_equal 2, Firm.all.merge!(:order => "id").first.clients.where(blank).to_a.size
end
end