-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 1.5 #342
Merged
Merged
Release 1.5 #342
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows specifying a `:links` option to a has_many/has_one relationship, which means you can specify `self` or `related` links as per the JSON API spec (these are often useful for not loading all associated objects in a single payload)
Fix set_key_transform's set_type to give priority to pre-set value
If you include a default empty `data` option in your JSON API response, many frontend frameworks will ignore your `related` link that could be used to load relationship records, and will instead treat the relationship as empty. This adds a `lazy_load_data` option which will: * stop the serializer attempting to load the data and; * exclude the `data` key from the final response This allows you to lazy load a JSON API relationship.
`5.minutes` was failing in the performance spec
Allow an ID of object to be customized directly on the serializer by passing a block to `set_id` as opposed to only through a model property. We already allow for attributes that do not have a model property of the same name to be customized directly on the serializer using a block. This customization can be useful in situation in which you have different classes being serialized using the same serializer. For example, if we have `HorrorMovie`, `ComedyMovie` and `DramaMovie` using the same `MovieSerializer`, we can unify their IDs using ``` class MovieSerializer include FastJsonapi::ObjectSerializer attributes :name, :year set_id do |record| "#{record.name.downcase}-#{record.id}" end ``` which is preferable to creating a `#serialized_id` method in every model that will use `MovieSerializer` to encapsulate the customization. Closes #315
Don't share data_links among inherited serializers.
Improve documentation with id_method_name
added spec for has_one-through relationship
Resolve minor typo
Fix params not being hash by default
Minor fix in README.md
require AS core extension for time
…rializer Adds a :links option to the relationship macros
Allow block for id customization
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.