Skip to content
Browse files

the index option is always created if the type is one of references o…

…r belongs_to. Refactoring it to a simpler form and fixing the build
  • Loading branch information...
1 parent 3b0ffb1 commit 938464d475877377bb84512930f0a96953f63f57 @vijaydev vijaydev committed Apr 18, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 railties/lib/rails/generators/generated_attribute.rb
View
6 railties/lib/rails/generators/generated_attribute.rb
@@ -22,8 +22,10 @@ def parse(column_definition)
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

0 comments on commit 938464d

Please sign in to comment.
Something went wrong with that request. Please try again.