class ActiveRecord::Relation::HashMerger
:nodoc:
def initialize(relation, hash)
def initialize(relation, hash) hash.assert_valid_keys(*Relation::VALUE_METHODS) @relation = relation @hash = hash end
def merge
def merge Merger.new(relation, other).merge end
def other
build a relation to merge in rather than directly merging
interpolation might take place for where values. So we should
Applying values to a relation has some side effects. E.g.
def other other = Relation.new(relation.klass, relation.table) hash.each { |k, v| if k == :joins if Hash === v other.joins!(v) else other.joins!(*v) end else other.send("#{k}!", v) end } other end