Sha256: 4c3179cf24525729b18a06a98ee6a35706054cf12b87d279c85e5efec4d72279

Contents?: true

Size: 1.23 KB

Versions: 66

Compression:

Stored size: 1.23 KB

Contents

module Effective
  module Resources
    module Klass

      def klass
        @model_klass
      end

      def datatable_klass
        @datatable_klass ||= if defined?(EffectiveDatatables)
          "#{namespaced_class_name.pluralize}Datatable".safe_constantize ||
          "#{class_name.pluralize.camelize}Datatable".safe_constantize ||
          "#{name.pluralize.camelize}Datatable".safe_constantize ||
          "Effective::Datatables::#{namespaced_class_name.pluralize}".safe_constantize ||
          "Effective::Datatables::#{class_name.pluralize.camelize}".safe_constantize ||
          "Effective::Datatables::#{name.pluralize.camelize}".safe_constantize
        end
      end

      def controller_klass
        @controller_klass ||= (
          "#{namespaced_class_name.pluralize}Controller".safe_constantize ||
          "#{class_name.pluralize.classify}Controller".safe_constantize ||
          "#{name.pluralize.classify}Controller".safe_constantize ||
          "#{initialized_name.to_s.classify.pluralize}Controller".safe_constantize ||
          "#{initialized_name.to_s.classify}Controller".safe_constantize
        )
      end

      def active_record?
        klass.ancestors.include?(ActiveRecord::Base)
      end

    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
effective_resources-0.9.5 app/models/effective/resources/klass.rb
effective_resources-0.9.4 app/models/effective/resources/klass.rb
effective_resources-0.9.3 app/models/effective/resources/klass.rb
effective_resources-0.9.2 app/models/effective/resources/klass.rb
effective_resources-0.9.1 app/models/effective/resources/klass.rb
effective_resources-0.9.0 app/models/effective/resources/klass.rb
effective_resources-0.8.26 app/models/effective/resources/klass.rb
effective_resources-0.8.25 app/models/effective/resources/klass.rb
effective_resources-0.8.24 app/models/effective/resources/klass.rb
effective_resources-0.8.23 app/models/effective/resources/klass.rb
effective_resources-0.8.22 app/models/effective/resources/klass.rb
effective_resources-0.8.21 app/models/effective/resources/klass.rb
effective_resources-0.8.20 app/models/effective/resources/klass.rb
effective_resources-0.8.19 app/models/effective/resources/klass.rb
effective_resources-0.8.18 app/models/effective/resources/klass.rb
effective_resources-0.8.17 app/models/effective/resources/klass.rb
effective_resources-0.8.16 app/models/effective/resources/klass.rb
effective_resources-0.8.15 app/models/effective/resources/klass.rb
effective_resources-0.8.14 app/models/effective/resources/klass.rb
effective_resources-0.8.13 app/models/effective/resources/klass.rb