lib/acts_as.rb in acts_as-0.4.0 vs lib/acts_as.rb in acts_as-0.4.1

- old
+ new

@@ -33,10 +33,10 @@ module ClassMethods def acts_as(association, with: [], prefix: [], **options) belongs_to(association, **options.merge(autosave: true)) define_method(association) do |*args| acted = super(*args) || send("build_#{association}", *args) - acted.save(validate: false) unless acted.persisted? + acted.save if persisted? && acted.new_record? acted end if (association_class = (options[:class_name] || association).to_s.camelcase.constantize).table_exists? whitelist_and_delegate_fields(association_class, association, prefix, with)