rails/rails — pull request #17970 by ulissesalmeida (2014-12-08 19:50:25+00:00)
Title: Add foreign_type option for polymorphic has_one and has_many.

To be possible to use a custom column name to save/read the polymorphic
associated type in a has_many or has_one polymorphic association, now users
can use the option :foreign_type to inform in what column the associated object
type will be saved.

The issue [2822](https://github.com/rails/rails/issues/2822) is associated to this change.

I have opened this #17899 but pointing to a stable branch, now I'm opening to be able to merge on master.

I created a self contained [gist](https://gist.github.com/ulissesalmeida/80c54b03b96d9201928f) that shows how this option can be useful working on legacy database systems.