Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixing the build #5882

Merged
merged 1 commit into from

2 participants

@vijaydev
Collaborator

Refactor the code to a simpler form instead of depending on and/&& semantics.

@vijaydev vijaydev 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
938464d
@spastorino spastorino merged commit e3a3a14 into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 17, 2012
  1. @vijaydev

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

    vijaydev authored
    …r belongs_to. Refactoring it to a simpler form and fixing the build
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.