Sha256: 63d4da424a4820898eaa9918dfa4fe18a9189e4cb8b255b34bb09b1d09034074

Contents?: true

Size: 482 Bytes

Versions: 11

Compression:

Stored size: 482 Bytes

Contents

module Cms
  # 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: https://gist.github.com/sj26/5843855
  module PolymorphicSingleTableInheritance

    # Override model_name to return base_class Name.
    def model_name
      if self == base_class
        super
      else
        base_class.model_name
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
browsercms-artirix-4.0.4 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.3.3 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.3.2 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.3.1 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.3 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.2 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.1.1 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-artirix-4.0.0.rc1.art4 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-4.0.0.rc1 lib/cms/polymorphic_single_table_inheritance.rb
browsercms-4.0.0.beta lib/cms/polymorphic_single_table_inheritance.rb
browsercms-4.0.0.alpha lib/cms/polymorphic_single_table_inheritance.rb