lib/databasedotcom/sobject/sobject.rb in databasedotcom-ejholmes-1.3.4 vs lib/databasedotcom/sobject/sobject.rb in databasedotcom-ejholmes-1.3.5
- old
+ new
@@ -318,9 +318,10 @@
params.each do |attr, value|
case self.field_type(attr)
when "boolean"
params[attr] = value.is_a?(String) ? value.to_i != 0 : value
when "currency", "percent", "double"
+ value = value.gsub(/[^-0-9.0-9]/, '').to_f if value.respond_to?(:gsub)
params[attr] = value.to_f
when "date"
params[attr] = Date.parse(value) rescue Date.today
when "datetime"
params[attr] = DateTime.parse(value) rescue DateTime.now