Fix have_db_index_matcher bug on JRuby

So matched_index.unique actually returns an integer instead of true and returns nil instead of false in JRuby. This `!!` operator should fix it.
This commit is contained in:
Prem Sichanugrist 2011-09-18 21:40:47 +07:00
parent 6785f596b4
commit 1a3aeec47c
1 changed files with 2 additions and 2 deletions

View File

@ -58,11 +58,11 @@ module Shoulda # :nodoc:
def correct_unique?
return true if @unique.nil?
if matched_index.unique == @unique
if !!matched_index.unique == @unique
true
else
@missing = "#{table_name} has an index named #{matched_index.name} " <<
"of unique #{matched_index.unique}, not #{@unique}."
"of unique #{!!matched_index.unique}, not #{@unique}."
false
end
end