Skip to content

Commit

Permalink
mssql: deal with '()' wrapped around negative default values
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Aug 31, 2011
1 parent 9a34f86 commit 3277165
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/arjdbc/mssql/adapter.rb
Expand Up @@ -110,7 +110,7 @@ def default_value(value)
def type_cast(value)
return nil if value.nil? || value == "(null)" || value == "(NULL)"
case type
when :integer then value.to_i rescue unquote(value).to_i rescue value ? 1 : 0
when :integer then value.delete('()').to_i rescue unquote(value).to_i rescue value ? 1 : 0
when :primary_key then value == true || value == false ? value == true ? 1 : 0 : value.to_i
when :decimal then self.class.value_to_decimal(unquote(value))
when :datetime then cast_to_datetime(value)
Expand Down

0 comments on commit 3277165

Please sign in to comment.