aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-04-18 02:16:44 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-04-18 02:16:44 +0530
commit938464d475877377bb84512930f0a96953f63f57 (patch)
tree79156cc6457df6e83cb0a5a6e213b69a9258fd9f /railties/lib
parent3b0ffb1efd9d70bf89571d720d994425ba428419 (diff)
downloadrails-938464d475877377bb84512930f0a96953f63f57.tar.gz
rails-938464d475877377bb84512930f0a96953f63f57.tar.bz2
rails-938464d475877377bb84512930f0a96953f63f57.zip
the index option is always created if the type is one of references or belongs_to. Refactoring it to a simpler form and fixing the build
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/generated_attribute.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb
index 21167359cc..50e7aa85ac 100644
--- a/railties/lib/rails/generators/generated_attribute.rb
+++ b/railties/lib/rails/generators/generated_attribute.rb
@@ -22,8 +22,10 @@ module Rails
type, attr_options = *parse_type_and_options(type)
- references_index = type.in?(%w(references belongs_to)) && UNIQ_INDEX_OPTIONS.include?(has_index) ? {:unique => true} : true
- attr_options.merge!({:index => references_index}) if references_index
+ if type.in?(%w(references belongs_to))
+ references_index = UNIQ_INDEX_OPTIONS.include?(has_index) ? {:unique => true} : true
+ attr_options.merge!({:index => references_index})
+ end
new(name, type, has_index, attr_options)
end