Sha256: 26289055788b7ec4a7e3376fb5aa3757d94aefe494d0b4687ac1df0decf582eb
Contents?: true
Size: 930 Bytes
Versions: 11
Compression:
Stored size: 930 Bytes
Contents
module Superstore module Model extend ActiveSupport::Concern included do class_attribute :symbolized_config self.symbolized_config = {} end module ClassMethods def base_class class_of_active_record_descendant(self) end def config=(config) self.symbolized_config = config.deep_symbolize_keys end def config symbolized_config end private # Returns the class descending directly from ActiveRecord::Base or an # abstract class, if any, in the inheritance hierarchy. def class_of_active_record_descendant(klass) if klass == Base || klass.superclass == Base klass elsif klass.superclass.nil? raise "#{name} doesn't belong in a hierarchy descending from Superstore" else class_of_active_record_descendant(klass.superclass) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems