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
Ensure AR #second, #third, etc. finders work through associations

This commit fixes two regressions introduced in cafe31a078 where
newly created finder methods #second, #third, #forth, and #fifth
caused a NoMethodError error on reload associations and where we
were pulling the wrong element out of cached associations.

Examples:

  some_book.authors.reload.second

  # Before
  # => NoMethodError: undefined method 'first' for nil:NilClass

  # After
  # => #<Author id: 2, name: "Sally Second", ...>

  some_book.first.authors.first
  some_book.first.authors.second

  # Before
  # => #<Author id: 1, name: "Freddy First", ...>
  # => #<Author id: 1, name: "Freddy First", ...>

  # After
  # => #<Author id: 1, name: "Freddy First", ...>
  # => #<Author id: 2, name: "Sally Second", ...>

Fixes #13783.
Fix typo
Merge pull request #13786 from terracatta/master

Ensure AR #second, #third, etc. finders work through associations
Calling reset on a collection association should unload the assocation

Need to define #reset on CollectionProxy.
[ci skip] Added missing `file` delivery method
Merge pull request #13728 from semenyukdmitriy/master

Added missing `file` delivery method to the Configuration Guide
Remove duplicate merge
put core at the beginning so other classes can modify the behavior
Merge pull request #13790 from kschlarman/collection_association_reset_fix

Calling reset on a collection association should unload the assocation
Make CollectionProxy#reset return self
Improve the CHANGELOG entry [ci skip]
Merge pull request #13791 from kei-s/remove_duplicate_merge

Remove duplicate merge
Move changed_attributes into dirty.rb
Move serialization dirty into serialization.rb
Merge pull request #13799 from kbrock/better_dirty

Better ActiveRecord hierarchy for Dirty and others