Sha256: 71d7b88af11598da9e61d59ef38e32a193815766e799cc27bc97b5bfd7436f9b
Contents?: true
Size: 965 Bytes
Versions: 1
Compression:
Stored size: 965 Bytes
Contents
require 'granite/form/model/attributes/reflections/reference_one' require 'granite/form/model/attributes/reference_one' module Granite module Form 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( Granite::Form::Model::Attributes::Reflections::ReferenceOne, reflection.reference_key, type: reflection.persistence_adapter.primary_key_type, 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
granite-form-0.6.0 | lib/granite/form/model/associations/reflections/references_one.rb |