Sha256: 18567e764cb2706432cb4e4059e3f9a301f63c27840147cca71ade7df419cb74

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

module SchemaPlusIndexes
  module ActiveRecord

    module Base
      def self.included(base) #:nodoc:
        base.extend(ClassMethods)
      end

      module ClassMethods #:nodoc:

        public

        # Returns a list of IndexDefinition objects, for each index
        # defind on this model's table.
        #
        def indexes
          @indexes ||= connection.indexes(table_name, "#{name} Indexes")
        end

        # (reset_index_information gets called by by Middleware::Model::ResetColumnInformation)
        def reset_index_information
          @indexes = nil
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schema_plus_indexes-0.1.1 lib/schema_plus_indexes/active_record/base.rb
schema_plus_indexes-0.1.0 lib/schema_plus_indexes/active_record/base.rb