Extract all attribute changed work to its own method

This will make easier to hook on this feature to customize the behavior
Make enum feature work with dirty methods

To make this possible we have to override the save_changed_attribute
hook.
Add more tests for the dirty feature for enums
Store the enum values in the DEFINED_ENUM constant

This will make simpler to compare if the values changed in the
save_changed_attribute method.
Use string as keys
Merge pull request #13776 from rails/dirty-enum

Implement the Dirty API with the Enum feature correctly.

Conflicts:
	activerecord/CHANGELOG.md