Extract Resource#find's resource transformation#718
Merged
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom May 23, 2016
rfb:topic/abstract_resources_for
Merged
Extract Resource#find's resource transformation#718lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom rfb:topic/abstract_resources_for
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
rfb:topic/abstract_resources_for
Conversation
Most of the behaviour of JSONAPI::Resource#find can be controlled by reimplementing #records, #filter_record, #sort_record, etc. By moving the resource transformation into #resources_for, we've remove one of the final bits of logic out of the #find. All #find defines is the order of operations and in many cases can be left as is. My specific use case is to delegate a single class of models to different resources. The caching behaviour in #find's transformation prevents me from simply reimplementing Resource#resource_for.
Contributor
|
@rfb Thanks! |
Contributor
Author
|
Great, thanks @lgebhardt - great work on JSONAPI::Resources! it's been a pleasure to implement into our stack. |
This file contains hidden or 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
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.
Most of the behaviour of JSONAPI::Resource#find can be controlled by
reimplementing #records, #filter_record, #sort_record, etc. By moving the
resource transformation into #resources_for, we've remove one of the final bits
of logic out of the #find. All #find defines is the order of operations and in
many cases can be left as is.
My specific use case is to delegate a single class of models to different
resources. The caching behaviour in #find's transformation prevents me from
simply reimplementing Resource#resource_for.