Sha256: c22fe7a351a5efb5799c716f4d04cd7f0d434722e89e52c4c356919197705069
Contents?: true
Size: 805 Bytes
Versions: 9
Compression:
Stored size: 805 Bytes
Contents
require 'active_data/model/attributes/reflections/reference_many' require 'active_data/model/attributes/reference_many' module ActiveData module Model module Associations module Reflections class ReferencesMany < ReferencesAny def self.build(target, generated_methods, name, *args, &block) reflection = super target.add_attribute( ActiveData::Model::Attributes::Reflections::ReferenceMany, reflection.reference_key, association: name ) reflection end def reference_key @reference_key ||= options[:reference_key].presence.try(:to_sym) || :"#{name.to_s.singularize}_#{primary_key.to_s.pluralize}" end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems