Module: DynamicModelActiveRecordExtensions::ClassMethods
- Defined in:
- lib/dynamic_model_active_record_extensions.rb
Instance Method Summary collapse
-
#sti_model? ⇒ Boolean
if this class has a type attribute, then it is a model which is using single table inheritance if it is the base class for STI, its parent will be ActiveRecord::Base – if using AR.
-
#sti_parent_class ⇒ Object
for creating routes which are based on the parent class.
Instance Method Details
#sti_model? ⇒ Boolean
if this class has a type attribute, then it is a model which is using single table inheritance if it is the base class for STI, its parent will be ActiveRecord::Base – if using AR.
21 22 23 24 |
# File 'lib/dynamic_model_active_record_extensions.rb', line 21 def sti_model? return false if sti_parent_class == ActiveRecord::Base attribute_names.include? "type" end |
#sti_parent_class ⇒ Object
for creating routes which are based on the parent class
27 28 29 |
# File 'lib/dynamic_model_active_record_extensions.rb', line 27 def sti_parent_class self.superclass end |