Skip to content

Commit

Permalink
HoboFields rich types fix - was converting blanks to 0 for numeric types
Browse files Browse the repository at this point in the history
  • Loading branch information
tslocke committed Apr 7, 2009
1 parent 15e407f commit 8664b71
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hobofields/lib/hobo_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def to_name(type)


def can_wrap?(type, val)
col_type = type::COLUMN_TYPE
return false if val.blank? && (col_type == :integer || col_type == :float || col_type == :decimal)
klass = Object.instance_method(:class).bind(val).call # Make sure we get the *real* class
arity = type.instance_method(:initialize).arity
(arity == 1 || arity == -1) && !@never_wrap_types.any? { |c| klass <= c }
Expand Down

0 comments on commit 8664b71

Please sign in to comment.