Sha256: e8de9efcfb5f4677a7898b9c55405116b6db852d954af645d1cc578327425aee
Contents?: true
Size: 674 Bytes
Versions: 21
Compression:
Stored size: 674 Bytes
Contents
module ActiveRecord module Associations class Association def creation_attributes attributes = {} if (reflection.macro == :has_one || reflection.macro == :has_many) && !options[:through] # CPK # attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key] Array(reflection.foreign_key).zip(Array(reflection.active_record_primary_key)).each do |key1, key2| attributes[key1] = owner[key2] end if reflection.options[:as] attributes[reflection.type] = owner.class.base_class.name end end attributes end end end end
Version data entries
21 entries across 21 versions & 1 rubygems