Module: DynamicModelActiveRecordExtensions

Included in:
ActiveRecord::Base
Defined in:
lib/dynamic_model_active_record_extensions.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/dynamic_model_active_record_extensions.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#sti_model?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/dynamic_model_active_record_extensions.rb', line 7

def sti_model?
  return false if sti_parent_class == ActiveRecord::Base
  attribute_names.include? "type"
end

#sti_parent_classObject

for creating routes which are based on the parent class



13
14
15
# File 'lib/dynamic_model_active_record_extensions.rb', line 13

def sti_parent_class
  self.class.superclass
end