diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-03-25 17:47:25 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-03-25 17:47:25 +0900 |
commit | e1533d2d5a631859ea47702ab64c11bba420b5b8 (patch) | |
tree | 2ec43db07abb23be0b9ce41047cc2534ceb1a362 /activerecord/lib/active_record | |
parent | 4b884fc732c574c40296a2f78816b25a06b64ffe (diff) | |
download | rails-e1533d2d5a631859ea47702ab64c11bba420b5b8.tar.gz rails-e1533d2d5a631859ea47702ab64c11bba420b5b8.tar.bz2 rails-e1533d2d5a631859ea47702ab64c11bba420b5b8.zip |
Always need to extract `value.bound_attributes` if `value.is_a?(Relation)`
Because `RelationHandler` uses `value.arel`.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index ec1861bd85..fca914aedd 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -87,6 +87,7 @@ module ActiveRecord binds = [] attributes.each do |column_name, value| + binds.concat(value.bound_attributes) if value.is_a?(Relation) case when value.is_a?(Hash) && !table.has_column?(column_name) attrs, bvs = associated_predicate_builder(column_name).create_binds_for_hash(value) @@ -99,9 +100,6 @@ module ActiveRecord # For polymorphic relationships, find the foreign key and type: # PriceEstimate.where(estimate_of: treasure) result[column_name] = AssociationQueryHandler.value_for(table, column_name, value) - binds.concat(value.bound_attributes) if value.is_a?(Relation) - when value.is_a?(Relation) - binds += value.bound_attributes when value.is_a?(Range) && !table.type(column_name).respond_to?(:subtype) first = value.begin last = value.end |