Method: ActiveRecord::Relation::HashMerger#other
- Defined in:
- activerecord/lib/active_record/relation/merger.rb
#other ⇒ Object
Applying values to a relation has some side effects. E.g. interpolation might take place for where values. So we should build a relation to merge in rather than directly merging the values.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'activerecord/lib/active_record/relation/merger.rb', line 25 def other other = Relation.create( relation.klass, table: relation.table, predicate_builder: relation.predicate_builder ) hash.each do |k, v| k = :_select if k == :select if Array === v other.public_send("#{k}!", *v) else other.public_send("#{k}!", v) end end other end |