diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-01 14:49:32 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-01 14:49:32 -0200 |
commit | 82701cd61e2e4ba0fd70be0c7547d1d783ef2d51 (patch) | |
tree | 23012b42128cdfa5aa20862a89ac775af8538f40 /activesupport/lib | |
parent | 9b2a017aa82f95911280ed597e4bf3193c9399e9 (diff) | |
parent | 8dd4aca4850c678f96d0a72098b3a080b51dea44 (diff) | |
download | rails-82701cd61e2e4ba0fd70be0c7547d1d783ef2d51.tar.gz rails-82701cd61e2e4ba0fd70be0c7547d1d783ef2d51.tar.bz2 rails-82701cd61e2e4ba0fd70be0c7547d1d783ef2d51.zip |
Merge pull request #12769 from birkirb/master
Boolean parser blows up on a Fixnum.
Conflicts:
activesupport/CHANGELOG.md
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/xml_mini.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb index d082a0a499..009ee4db90 100644 --- a/activesupport/lib/active_support/xml_mini.rb +++ b/activesupport/lib/active_support/xml_mini.rb @@ -1,7 +1,9 @@ require 'time' require 'base64' +require 'bigdecimal' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/string/inflections' +require 'active_support/core_ext/date_time/calculations' module ActiveSupport # = XmlMini @@ -56,13 +58,13 @@ module ActiveSupport # TODO use regexp instead of Date.parse unless defined?(PARSING) PARSING = { - "symbol" => Proc.new { |symbol| symbol.to_sym }, + "symbol" => Proc.new { |symbol| symbol.to_s.to_sym }, "date" => Proc.new { |date| ::Date.parse(date) }, "datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc }, "integer" => Proc.new { |integer| integer.to_i }, "float" => Proc.new { |float| float.to_f }, "decimal" => Proc.new { |number| BigDecimal(number) }, - "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) }, + "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) }, "string" => Proc.new { |string| string.to_s }, "yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml }, "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) }, |