Module: ActiveRecord::SimpleIndexName::ActiveRecordExt_7_0

Defined in:
lib/active_record/simple_index_name/active_record_ext_7_0.rb

Instance Method Summary collapse

Instance Method Details

#index_name(table_name, options) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/active_record/simple_index_name/active_record_ext_7_0.rb', line 4

def index_name(table_name, options)
  if ActiveRecord::SimpleIndexName.current_shorten? && Hash === options && options[:column]
    Array.wrap(options[:column]) * "_and_"
  else
    super
  end
end

#rename_index(table_name, old_name, new_name) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/active_record/simple_index_name/active_record_ext_7_0.rb', line 12

def rename_index(table_name, old_name, new_name)
  if ActiveRecord::SimpleIndexName.current_shorten? && old_name == new_name
    # nop
  else
    super
  end
end