aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-07-18 00:16:39 -0700
committerJosé Valim <jose.valim@plataformatec.com.br>2012-07-18 00:16:39 -0700
commit58ccc9f6c5d261f7c1305d822b16447ac3d286b3 (patch)
treef47e5097d83b04464904fa56d0f65bc91b521fc8 /railties/lib/rails
parent17b6fa877752c217a9171b7f420bc86d55fddcbc (diff)
parent211d88b71b3df2ae161b23579a79f8e937132388 (diff)
downloadrails-58ccc9f6c5d261f7c1305d822b16447ac3d286b3.tar.gz
rails-58ccc9f6c5d261f7c1305d822b16447ac3d286b3.tar.bz2
rails-58ccc9f6c5d261f7c1305d822b16447ac3d286b3.zip
Merge pull request #7028 from lexmag/join_table_indexes
Add indexes to create_join_table method
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/generators/generated_attribute.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb
index d480fc12b5..35cd40d25e 100644
--- a/railties/lib/rails/generators/generated_attribute.rb
+++ b/railties/lib/rails/generators/generated_attribute.rb
@@ -8,6 +8,7 @@ module Rails
attr_accessor :name, :type
attr_reader :attr_options
+ attr_writer :index_name
class << self
def parse(column_definition)
@@ -94,7 +95,7 @@ module Rails
end
def index_name
- if reference?
+ @index_name ||= if reference?
polymorphic? ? %w(id type).map { |t| "#{name}_#{t}" } : "#{name}_id"
else
name