4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/active_record/simple_index_name/active_record_ext.rb', line 4
def index_name_with_simple(table_name, options)
shorten_mode =
case Thread.current[:simple_index_name_shorten_mode]
when :enable
true
when :disable
false
else
ActiveRecord::SimpleIndexName.config.auto_shorten
end
if shorten_mode
if Hash === options && options[:column]
Array.wrap(options[:column]) * "_and_"
else
index_name_without_simple(table_name, options)
end
else
index_name_without_simple(table_name, options)
end
end
|