Sets the attribute used for single table inheritance to this class name if this is not the ActiveRecord::Base descendant. Considering the hierarchy Reply < Message < ActiveRecord::Base, this makes it possible to do Reply.new without having to set Reply = "Reply" yourself. No such attribute would be set for objects of the Message class in that example.
# File activerecord/lib/active_record/inheritance.rb, line 167 def ensure_proper_type klass = self.class if klass.finder_needs_type_condition? write_attribute(klass.inheritance_column, klass.sti_name) end end