Skip to content
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

Makes singleton resources finding with an id work #447

Merged
merged 8 commits into from
Mar 18, 2024

Conversation

doublevoid
Copy link
Contributor

Creating a resource, setting a primary endpoint, and then using ResourceName.find({id: id}) doesn't work if the controller is set up as a show action.
You get ResourceName cannot be called directly from endpoint /api/v1/resource#show!

This is why.
A workaround is to either go with self.validate_endpoints = false or change the action to be an index action, which bypasses the stripping of a would-be id.

This PR changes the behavior to only strip the id from path if the id is actually in path!

@jkeen jkeen merged commit e1dd811 into graphiti-api:master Mar 18, 2024
35 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 18, 2024
## [1.5.3](v1.5.2...v1.5.3) (2024-03-18)

### Bug Fixes

* leverage ruby-2.7 parameter forwarding ([#431](#431)) ([ae09a46](ae09a46))
* prevent :id stripping when :id not in path ([#447](#447)) ([e1dd811](e1dd811))
Copy link

🎉 This PR is included in version 1.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

jkeen pushed a commit to jkeen/graphiti that referenced this pull request Mar 27, 2024
Address edge case where ResourceName.find({id: id}) would error if controller was set up as a show action
jkeen pushed a commit to jkeen/graphiti that referenced this pull request Mar 27, 2024
## [1.5.3](graphiti-api/graphiti@v1.5.2...v1.5.3) (2024-03-18)

### Bug Fixes

* leverage ruby-2.7 parameter forwarding ([graphiti-api#431](graphiti-api#431)) ([ae09a46](graphiti-api@ae09a46))
* prevent :id stripping when :id not in path ([graphiti-api#447](graphiti-api#447)) ([e1dd811](graphiti-api@e1dd811))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants