lib/classy-inheritance.rb in classy-inheritance-0.3.0 vs lib/classy-inheritance.rb in classy-inheritance-0.4.0
- old
+ new
@@ -62,13 +62,17 @@
end
private
def define_relationship(model_sym, options)
- if options[:as]
- has_one model_sym, polymorphic_constraints(options[:as])
+ opts = options.dup
+ opts.delete(:attrs)
+ if opts[:as]
+ as_opt = opts.delete(:as)
+ opts = polymorphic_constraints(as_opt).merge(opts)
+ has_one model_sym, opts
else
- belongs_to model_sym
+ belongs_to model_sym, opts
end
end
def define_save_method(model_sym, polymorphic_name = nil)
define_method "save_requisite_#{model_sym}" do