ActiveSupport に標準の "json" gem の動作をオーバーライドしないように教える方法は?
require "rubygems"
gem "json"
require "json"
class Time
def to_json(options = nil)
"custom string"
end
end
hash = { :x => Time.now }
puts hash.to_json # => {"x":custom string}
gem "activesupport"
require "active_support/core_ext/object" # Somewhere into Rails internals
puts Time.now.to_json # => custom string
puts hash.to_json # => {"x":"2011-02-14T16:30:10+05:00"}
予想: require "active_support/core_ext/object" の後、{"x":custom string} の結果を取得したい。