partial_updates does not work when calling save_without_validation!

hey folks, I migrated to 2.1 from 2.0.2, turned on the partial_update functionality, and specs started to fail. It seems that calling 'save_without_validation!' on an existing object does not trigger the save_with_dirty! method.

The path is a bit convoluted, but when save_without_validation! is called... it calls: ActiveRecord::Base#update method -> then is overloaded by ActiveRecord::Dirty#update_with_dirty, which does not clear out the changed attributes.

adding a patch like the one pasted at the bottom of this msg fixes the issue.

I'm not sure if this is the right fix or not. It seems that calling save_without_validation! should still call the save_with_dirty! method, just like save! calls the save_with_dirty! method. The fact that it calls the update_with_dirty might just be 'luck'?

Thanks, Adam

**PATCH**

# HACK: why does this not work if I chain it from within the module Dirty? # It doesn't seem to pick it up if I use update_with_dirty_with_patch # and *_without_patch.... but this works as it is patched in after # ActiveRecord::Base has been extended with ActiveRecord::Dirty module ActiveRecord   class Base     def update_with_patch       update_without_patch       #FIX: make sure the changed attributes are cleared out after a successful update!!!       changed_attributes.clear rescue nil     end     alias_method_chain :update, :patch

  end end

just noting that I threw a possible patch down at the bottom of the note....

hey folks, I migrated to 2.1 from 2.0.2, turned on the partial_update functionality, and specs started to fail. It seems that calling 'save_without_validation!' on an existing object does not trigger the save_with_dirty! method.

Why are you calling save_without_validation!?

If you want to save without validations the 'public' api is:

@object.save(false)

The bang seems counter-intuitive?

old habits I guess :wink:

good point! I'll change those deprecated calls... but it seems like it still makes sense to clear out the changed_attributes should be cleared after an update is run?

But I'll stop there because my original reason for this fix is now invalid.

thanks, Adam