You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where serializalbe_hash is where the options only, except, methods, include are defined, and as_json defines the option root and uses include_root_in_json.
The text was updated successfully, but these errors were encountered:
Expected behavior vs actual behavior
The only things that we should ever explicitly pass to
to_json
and friends are the options that go toActiveModel::Serialization
andActiveModel::Serializers::JSON
i.e.
only, except, methods, include
The reason is that
render json: resource, options
essentially results in the Rails Renderer logic below.This continues work from #1494
Related, #1572 fixes a case where we accidentally are using options passing into serializable_hash
Details
This is how AMS fits into rendering and why I'm thinking this way
where
serializalbe_hash
is where the optionsonly, except, methods, include
are defined, andas_json
defines the optionroot
and usesinclude_root_in_json
.The text was updated successfully, but these errors were encountered: