Module: Cms::PolymorphicSingleTableInheritance

Defined in:
lib/cms/polymorphic_single_table_inheritance.rb

Overview

Allows STI classes to be handled by a single resource controller i.e. LoginPortlet can be handled by the Cms::PortletController as a resource.

This is a simpler version of this solution: gist.github.com/sj26/5843855

Instance Method Summary collapse

Instance Method Details

#model_nameObject

Override model_name to return base_class Name.



10
11
12
13
14
15
16
# File 'lib/cms/polymorphic_single_table_inheritance.rb', line 10

def model_name
  if self == base_class
    super
  else
    base_class.model_name
  end
end