Module: Rails::Patch::Json::Encode::ToJsonWithMultiJson
- Defined in:
- lib/rails/patch/json/encode.rb
Overview
Combine devblog.agworld.com.au/post/42586025923/the-performance-of-to-json-in-rails-sucks-and-theres and Rails’ ToJsonWithActiveSupportEncoder together, essentially reversing Rails’ hard-coded call to ActiveSupport::JSON.encode
Instance Method Summary collapse
Instance Method Details
#to_json(options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/rails/patch/json/encode.rb', line 30 def to_json( = {}) if .is_a?(::JSON::State) super() else ::MultiJson::dump(self.as_json(), ) end end |