lib/classy-inheritance.rb in classy-inheritance-0.4.1 vs lib/classy-inheritance.rb in classy-inheritance-0.4.2

- old
+ new

@@ -80,10 +80,16 @@ if polymorphic_name eval("self.#{model_sym}.#{polymorphic_name}_type = self.class.name") eval("self.#{model_sym}.#{polymorphic_name}_id = self.id") end - unless polymorphic_name + if polymorphic_name + eval <<-SAVEIT + unless self.#{model_sym}.new_record? + self.#{model_sym}.save + end + SAVEIT + else eval("self.#{model_sym}.save") end end before_save "save_requisite_#{model_sym}".to_sym