Commit 3c2ba9b
committed
Extract Resource#find's resource transformation
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.1 parent 5e4fd81 commit 3c2ba9b
2 files changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
639 | 643 | | |
640 | 644 | | |
641 | 645 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
614 | 619 | | |
0 commit comments