Module: UpdateableViewsInheritance::ActiveRecordExtensions::ClassMethods
- Defined in:
- lib/updateable_views_inheritance/active_record_extensions.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#disable_inheritance_instantiation ⇒ Object
Returns the value of attribute disable_inheritance_instantiation.
Instance Method Summary collapse
Instance Attribute Details
#disable_inheritance_instantiation ⇒ Object
Returns the value of attribute disable_inheritance_instantiation.
5 6 7 |
# File 'lib/updateable_views_inheritance/active_record_extensions.rb', line 5 def disable_inheritance_instantiation @disable_inheritance_instantiation end |
Instance Method Details
#instantiate(attributes, column_types = {}) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/updateable_views_inheritance/active_record_extensions.rb', line 7 def instantiate(attributes, column_types = {}) object = super(attributes, column_types = {}) if object.class.name == self.name || self.disable_inheritance_instantiation object else object.class.find(attributes.with_indifferent_access[:id]) end end |