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

Allow passing AR records to jsonapi_* http operations #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jasonkarns
Copy link

@jasonkarns jasonkarns commented Nov 1, 2022

Rationale: the jsonapi_* helpers for GET/POST/PUT/PATCH/DELETE each accept a url. In many api specs, the url can be derived from the ActiveRecord record(s) that are created before-hand. This allows the specs to pass the AR records to the jsonapi_* helpers directly and have the URL derived from the model the same way that Rails derives its routing for a given AR model instance.

that allows make_request subjects like:
jsonapi_get order, jsonapi_put user, jsonapi_delete card and for index: jsonapi_get products_path

Initial slack discussion: https://graphiti-api.slack.com/archives/C5A4UEMGS/p1658959255745979

The url_for helper still accepts a regular string, so it should be backwards compatible with existing usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant