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