diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-16 09:50:49 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-16 09:51:47 -0700 |
commit | 4d8f62dcfa0a5157b3facbd71f75fc6639636347 (patch) | |
tree | 3459041084d61b881b8cd33715989ecf21fe0ef6 /activerecord/lib/active_record | |
parent | 833aef438dab57c2c6523686fa9754faa023cd10 (diff) | |
download | rails-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.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/where_clause_factory.rb | 2 |
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) |