Module: DynamicModelActiveRecordExtensions::ClassMethods

Defined in:
lib/dynamic_model_active_record_extensions.rb

Instance Method Summary collapse

Instance Method Details

#sti_model?Boolean

if this class has a type attribute, then it is a model which is using single table inheritance

Returns:

  • (Boolean)


19
20
21
# File 'lib/dynamic_model_active_record_extensions.rb', line 19

def sti_model?
  attribute_names.include? "type"
end

#sti_parent_classObject

for creating routes which are based on the parent class



24
25
26
# File 'lib/dynamic_model_active_record_extensions.rb', line 24

def sti_parent_class
  self.parent
end