Created
January 10, 2013 04:42
-
-
Save presidentbeef/4499538 to your computer and use it in GitHub Desktop.
Simple way to disable XML parsing of symbol/YAML types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#activesupport/lib/active_support/core_ext/hash/conversions.rb | |
unless defined?(XML_PARSING) | |
XML_PARSING = { | |
- "symbol" => Proc.new { |symbol| symbol.to_sym }, | |
+ "symbol" => Proc.new { |symbol| symbol.to_s }, | |
"date" => Proc.new { |date| ::Date.parse(date) }, | |
"datetime" => Proc.new { |time| ::Time.parse(time).utc rescue ::DateTime.parse(time).utc }, | |
"integer" => Proc.new { |integer| integer.to_i }, | |
@@ -76,7 +76,7 @@ module ActiveSupport #:nodoc: | |
"decimal" => Proc.new { |number| BigDecimal(number) }, | |
"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) }, | |
"string" => Proc.new { |string| string.to_s }, | |
- "yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml }, | |
+ "yaml" => Proc.new { |yaml| yaml.to_s }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment