Permalink
Browse files

HoboFields rich types fix - was converting blanks to 0 for numeric types

  • Loading branch information...
tslocke committed Apr 7, 2009
1 parent 15e407f commit 8664b71641e728cb36eab4a6b8e7c31d999a4605
Showing with 2 additions and 0 deletions.
  1. +2 −0 hobofields/lib/hobo_fields.rb
@@ -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 }

0 comments on commit 8664b71

Please sign in to comment.