Sha256: fde0faa28eb162e626591575f2fc3bc7b29286331d23db22cc6450c9688cea36

Contents?: true

Size: 584 Bytes

Versions: 3

Compression:

Stored size: 584 Bytes

Contents

module ActiveCollection
  module MemberClass
    def self.included(mod)
      mod.extend(ClassMethods)
    end

    module ClassMethods
      def model_class
        @model_class ||= name.sub(/Collection$/,'').constantize
      end

      def table_name
        model_class.table_name
      end

      def human_name(*args)
        model_class.human_name(*args).pluralize
      end
    end

    def model_class
      self.class.model_class
    end

    def table_name
      self.class.table_name
    end

    def human_name(*args)
      self.class.human_name(*args)
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
martinemde-active_collection-0.2.2 lib/active_collection/member_class.rb
martinemde-active_collection-0.2.3 lib/active_collection/member_class.rb
active_collection-0.2.3 lib/active_collection/member_class.rb