lib/granite/form/model/associations/reflections/embeds_one.rb in granite-form-0.5.0 vs lib/granite/form/model/associations/reflections/embeds_one.rb in granite-form-0.6.0

- old
+ new

@@ -5,10 +5,13 @@ module Reflections class EmbedsOne < EmbedsAny include Singular def self.build(target, generated_methods, name, options = {}, &block) - target.add_attribute(Granite::Form::Model::Attributes::Reflections::Base, name, type: Object) if target < Granite::Form::Model::Attributes + 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)