method
encode_json
v3.2.13 -
Show latest stable
- Class:
Hash
encode_json(encoder)public
No documentation available.
# File activesupport/lib/active_support/json/encoding.rb, line 239
def encode_json(encoder)
# values are encoded with use_options = false, because we don't want hash representations from ActiveModel to be
# processed once again with as_json with options, as this could cause unexpected results (i.e. missing fields);
# on the other hand, we need to run as_json on the elements, because the model representation may contain fields
# like Time/Date in their original (not jsonified) form, etc.
"{#{map { |k,v| "#{encoder.encode(k.to_s)}:#{encoder.encode(v, false)}" } * ','}}"
end