aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-16 09:50:49 -0700
committerSean Griffin <sean@seantheprogrammer.com>2015-10-16 09:51:47 -0700
commit4d8f62dcfa0a5157b3facbd71f75fc6639636347 (patch)
tree3459041084d61b881b8cd33715989ecf21fe0ef6 /activerecord/lib/active_record
parent833aef438dab57c2c6523686fa9754faa023cd10 (diff)
downloadrails-4d8f62dcfa0a5157b3facbd71f75fc6639636347.tar.gz
rails-4d8f62dcfa0a5157b3facbd71f75fc6639636347.tar.bz2
rails-4d8f62dcfa0a5157b3facbd71f75fc6639636347.zip
Move the handling of supported arguments to `where`
`WhereClauseFactory` handles all other branches based on argument types, so the code fits more naturally here, and it's just where the responsibility belongs.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb2
-rw-r--r--activerecord/lib/active_record/relation/where_clause_factory.rb2
2 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 0dcecbd42d..55fd0e0b52 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -552,8 +552,6 @@ module ActiveRecord
WhereChain.new(spawn)
elsif opts.blank?
self
- elsif !opts.is_a?(String) && !opts.respond_to?(:to_h)
- raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
else
spawn.where!(opts, *rest)
end
diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb
index 83ac074f97..9662756c2e 100644
--- a/activerecord/lib/active_record/relation/where_clause_factory.rb
+++ b/activerecord/lib/active_record/relation/where_clause_factory.rb
@@ -21,7 +21,7 @@ module ActiveRecord
parts = predicate_builder.build_from_hash(attributes)
else
- parts = [opts]
+ raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
end
WhereClause.new(parts, binds)