Skip to content

Instantly share code, notes, and snippets.

@presidentbeef
Created January 10, 2013 04:42
Show Gist options
  • Save presidentbeef/4499538 to your computer and use it in GitHub Desktop.
Save presidentbeef/4499538 to your computer and use it in GitHub Desktop.
Simple way to disable XML parsing of symbol/YAML types
#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