Sha256: 94db5aa847564e135c34c537807270948a494c2b5736430be891a75c517f8178
Contents?: true
Size: 935 Bytes
Versions: 1
Compression:
Stored size: 935 Bytes
Contents
module Granite module Form module Model module Associations module Reflections class EmbedsOne < EmbedsAny include Singular def self.build(target, generated_methods, name, options = {}, &block) if target < Granite::Form::Model::Attributes target.add_attribute(Granite::Form::Model::Attributes::Reflections::Base, name, type: Object) end options[:validate] = true unless options.key?(:validate) super end def self.generate_methods(name, target) super target.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def build_#{name} attributes = {} association(:#{name}).build(attributes) end RUBY 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/embeds_one.rb |