Sha256: 3bc2f9fccd59293f05eabf2a4627c045fd857e45efaedc9e583ccffb3321f890
Contents?: true
Size: 867 Bytes
Versions: 2
Compression:
Stored size: 867 Bytes
Contents
require 'granite/form/model/attributes/reflections/reference_many' require 'granite/form/model/attributes/reference_many' module Granite module Form module Model module Associations module Reflections class ReferencesMany < ReferencesAny def self.build(target, generated_methods, name, *args, &block) reflection = super target.add_attribute( Granite::Form::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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
granite-form-0.1.1 | lib/granite/form/model/associations/reflections/references_many.rb |
granite-form-0.1.0 | lib/granite/form/model/associations/reflections/references_many.rb |