ActiveRecord::Base#toggle! is used to toggle an attribute true or false, and immediatly save it. It is implemented to call the toggle method, and then call update_attribute to save to the database.
The problem I see with this is that there is no validation, when toggling a boolean. In my opinion this is wrong, and there should be validation. I've heard people say this behaviour was correct, and that's how they wanted it, in which case the documentation is incomplete and can lead to unexpected results.
def toggle!(attribute) toggle(attribute).update_attribute(attribute, self[attribute]) end
You tell me, a patch to make toggle! validate or a documentation patch to say toggle! doesn't validate when saving.
I have a ticket open at http://dev.rubyonrails.org/ticket/11098 about this.