class Bulb
Attributes
attributes_after_initialize[R]
scope_after_initialize[R]
Public Class Methods
new(attributes = {}, &block)
click to toggle source
Calls superclass method
ActiveRecord::Core::new
# File activerecord/test/models/bulb.rb, line 24 def self.new(attributes = {}, &block) bulb_type = (attributes || {}).delete(:bulb_type) if bulb_type.present? bulb_class = "#{bulb_type.to_s.camelize}Bulb".constantize bulb_class.new(attributes, &block) else super end end
Public Instance Methods
color=(color)
click to toggle source
# File activerecord/test/models/bulb.rb, line 20 def color=(color) self[:color] = color.upcase + "!" end
record_attributes_after_initialize()
click to toggle source
# File activerecord/test/models/bulb.rb, line 16 def record_attributes_after_initialize @attributes_after_initialize = attributes.dup end
record_scope_after_initialize()
click to toggle source
# File activerecord/test/models/bulb.rb, line 11 def record_scope_after_initialize @scope_after_initialize = self.class.all end