rails/rails — pull request #15889 by amiel (2014-06-24 00:16:53+00:00)
Title: Use #model_name on instances instead of classes

This allows rails code to be more confident when asking for a model name, instead of having to ask for the class.

I am looking for feedback on the sections labeled `REVIEW`. I will remove and rebase.

Addresses #15428.

See rails-core discussion at https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8

Also see #15871, which adds the instance change to ActiveModel, but doesn't use it in the rest of rails.
The most useful thing about this change, IMO, is the fact that rails can start calling `model_name` without first getting the objects class.

* ActiveModel::Naming delegates instance `#model_name`. There are a few
different ways we could handle this (see discussion at #15871), I'm open to suggestions.
* Normally, we would use include instead of extend if a module needs
to add instance methods. However, that would be a HUGE breaking change.
* I think I found all of the instances of `x.class.model_name` and converted
them, and all tests pass.