Sha256: 51cec4e6bb8ec10940b77c9d5f77d8f9b0b37f258fc453b91b116dd6df3b92f2

Contents?: true

Size: 353 Bytes

Versions: 6

Compression:

Stored size: 353 Bytes

Contents

#TODO: Use :dependent for FK cascade?

module ActiveRecord
  class Base
    class << self
      public
        def get_unique_index_columns
            self.connection.indexes(self.table_name, "#{self.name} Indexes").select { |index| index.unique && index.columns.size == 1 }.map{ |index| index.columns.first }
        end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
voraz-dr_nic_magic_models-0.9.2 lib/base.rb
voraz-dr_nic_magic_models-0.9.3 lib/base.rb
dr_nic_magic_models-0.9.1 lib/base.rb
dr_nic_magic_models-0.9.0 lib/base.rb
dr_nic_magic_models-0.9.2 lib/base.rb
magic_model_generator-0.3.0 lib/activerecord/base.rb