module ActiveRecord::Inheritance
Public Instance Methods
initialize_dup(other)
click to toggle source
Calls superclass method
# File lib/active_record/inheritance.rb, line 198 def initialize_dup(other) super ensure_proper_type end
Private Instance Methods
ensure_proper_type()
click to toggle source
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.inheritance_column] =
"Reply"
yourself. No such attribute would be set for
objects of the Message class in that example.
# File lib/active_record/inheritance.rb, line 215 def ensure_proper_type klass = self.class if klass.finder_needs_type_condition? write_attribute(klass.inheritance_column, klass.sti_name) end end
initialize_internals_callback()
click to toggle source
Calls superclass method
# File lib/active_record/inheritance.rb, line 205 def initialize_internals_callback super ensure_proper_type end