mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #10010 from pwnall/fix_ref_index_true
Make references with index:true pass Hash options to add_index
This commit is contained in:
commit
456bd7bfad
1 changed files with 1 additions and 1 deletions
|
@ -258,7 +258,7 @@ module ActiveRecord
|
||||||
args.each do |col|
|
args.each do |col|
|
||||||
column("#{col}_id", :integer, options)
|
column("#{col}_id", :integer, options)
|
||||||
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) if polymorphic
|
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) if polymorphic
|
||||||
index(polymorphic ? %w(id type).map { |t| "#{col}_#{t}" } : "#{col}_id", index_options.is_a?(Hash) ? index_options : nil) if index_options
|
index(polymorphic ? %w(id type).map { |t| "#{col}_#{t}" } : "#{col}_id", index_options.is_a?(Hash) ? index_options : {}) if index_options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias :belongs_to :references
|
alias :belongs_to :references
|
||||||
|
|
Loading…
Reference in a new issue