aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/where_clause_factory.rb
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2015-10-18 10:51:03 +0900
committeryui-knk <spiketeika@gmail.com>2015-10-18 10:51:03 +0900
commitb27fb2d8e76a31eb0d12b0bcea1fbd12dcf35320 (patch)
tree0ab4da5e348c8b127229c1dd3a95435c874507e1 /activerecord/lib/active_record/relation/where_clause_factory.rb
parent6c36c369be0cdd8f5f5b47f77ba79d492db98f32 (diff)
downloadrails-b27fb2d8e76a31eb0d12b0bcea1fbd12dcf35320.tar.gz
rails-b27fb2d8e76a31eb0d12b0bcea1fbd12dcf35320.tar.bz2
rails-b27fb2d8e76a31eb0d12b0bcea1fbd12dcf35320.zip
Green version of moving the handling of supported arguments to `where`
This commit follow up of 4d8f62d. The difference from 4d8f62d are below: * Change `WhereClauseFactory` to accept `Arel::Nodes::Node` * Change test cases of `relation_test.rb`
Diffstat (limited to 'activerecord/lib/active_record/relation/where_clause_factory.rb')
-rw-r--r--activerecord/lib/active_record/relation/where_clause_factory.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb
index 83ac074f97..a81ff98e49 100644
--- a/activerecord/lib/active_record/relation/where_clause_factory.rb
+++ b/activerecord/lib/active_record/relation/where_clause_factory.rb
@@ -20,8 +20,10 @@ module ActiveRecord
attributes, binds = predicate_builder.create_binds(attributes)
parts = predicate_builder.build_from_hash(attributes)
- else
+ when Arel::Nodes::Node
parts = [opts]
+ else
+ raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
end
WhereClause.new(parts, binds)