rails/rails — pull request #16146 by ericroberts (2014-07-12 00:30:10+00:00)
Title: Sti class name

I outlined what I'm trying to accomplish with this pull request here: https://groups.google.com/forum/#!topic/rubyonrails-core/QVjt2cs7NL4

A brief summary of the link above:

- I had a class 'Code' and a database table 'codes'.
- 'Code' had an attribute 'units', which could be either '$' or '%'
- I wanted the STI classes to be Code::Dollar or Code::Percent
- I was able to get this by redefining find_sti_class and sti_name, but it didn't work with build or new on the parent class

These changes will attempt to get a class for inheritance from find_sti_class, and if that doesn't work, will fall through to the old way of doing things.

This allows you to match whatever string is in your inheritance column in your database with whatever class you want by redefining `find_sti_class` and `sti_name`.