JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Sort methods not being called
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm running off of master (for the caching feature), and the sort/order methods (self.sortable_fields, self.default_sort, and self.apply_sort) are not being called in the resource.
This method is called when I use 0.7.0, but not on master:
class SomeResource < JSONAPI::Resource
def self.apply_sort(records, order_options, context = {})
throw records
records = records.order(id: :desc)
super(records, order_options, context)
end
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the sorting implementation on master with version 0.7.0, focusing on the resource methods self.sortable_fields, self.default_sort, and self.apply_sort. Reproduce the issue with the SomeResource example and confirm that the sort methods are invoked on master and apply_sort can order records as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100