* This adds namespace lookup to serializer_for
* address rubocop issue
* address @bf4's feedback
* add docs
* update docs, add more tests
* apparently rails master doesn't have before filter
* try to address serializer cache issue between tests
* update cache for serializer lookup to include namespace in the key, and fix the tests for explicit namespace
* update docs, and use better cache key creation method
* update docs [ci skip]
* update docs [ci skip]
* add to changelog [ci skip]
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
If you specify include_data false, and do not have any links for this
relationship, we would output something like:
`{ relationships: { comments: {} } }`
This is not valid jsonapi. We will now render
`{ relationships: { comments: { meta: {} } } }`
Instead.
Relevant jsonapi spec: http://jsonapi.org/format/#document-resource-object-relationships
Add docs for links
Add docs for links
Add docs for links
Add docs for links
Add docs for links
Add controller info
Grammar fixing
Improve docs
some small wording changes
Add pr to changelog
The `:attributes` adapter is the default one, but it did not support
key transformation. This was very surprising behavior, since the
"Configuration Options" page in the guides didn't mention that this
behavior was not supported by the attributes adapter.
This commit adds key transform support to the attributes adapter, and
adds documentation about the default transform for the attributes
adapter (which is `:unaltered`).
This commit also handles arrays when transforming keys, which was needed
in the case where you're serializing a collection with the Attributes
adapter. With the JSON adapter, it was always guaranteed to pass a hash
to the KeyTransform functions because of the top-level key. Since there
is no top-level key for the Attributes adapter, the return value could
be an array.
* replace reflection collection type with hash to prevent duplicated associations in some cases
* include tests
* Fix robucup offenses
* Improve test
* Remove usless requirement
* improve tests
* remove custom_options option from Post and InheritedPost serializer
* Improve tests
* update changelog
* update changelog
* Fix#1759, Grape integration, adds serialization_context
- `serialization_context` is added in grape formatter so grape continues to render models without an explicit call to the `render` helper method
- Made it straightforward for subclasses to add other serializer options (such as `serialization_scope`).
* Updated Grape tests to include:
- paginated collections
- implicit Grape serializer (i.e. without explicit invocation of `render` helper method)
* Update Changelog with fixes.
- improves improves serialization_context to take options and not depend
on a `request` object.
- adds descriptive error on missing serialization_context.
- Document overriding `CollectionSerializer#paginated?`.
This is useful to set application-wide default behavior - e.g. in
previous versions of AMS the default behavior was to serialize the
full object graph by default - equivalent to the '**' include tree.
Currently just the global setting, but I think this could also work
on a per-serializer basis, with more attention.
Adding documentation and short example ([from this pull request](https://github.com/rails-api/active_model_serializers/pull/1403)) on conditional attributes.
Adding lambda literal notation and example.
Adding lambda literal notation and example, and fixing typo.
Removing PR reminder
Adding Changelog entry
Moving CHANGELOG entry under master (unreleased)
Use option instead of parameter