mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Add include_data :if_sideloaded (#1931)
For JSONAPI, `include_data` currently means, "should we populate the 'data'" key for this relationship. Current options are true/false. This adds the `:if_sideloaded` option. This means "only populate the 'data' key when we are sideloading this relationship." This is because 'data' is often only relevant to sideloading, and causes a database hit. Addresses https://github.com/rails-api/active_model_serializers/issues/1555
This commit is contained in:
committed by
L. Preston Sego III
parent
6ed499f38e
commit
2145540795
@@ -30,6 +30,7 @@ module ActiveModel
|
||||
# Make JSON API top-level jsonapi member opt-in
|
||||
# ref: http://jsonapi.org/format/#document-top-level
|
||||
config.jsonapi_include_toplevel_object = false
|
||||
config.include_data_default = true
|
||||
|
||||
config.schema_path = 'test/support/schemas'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user