We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
My use case is to only include possible actions on a resource.
I want to omit ones which aren't relevant, depending on the resource state.
Something like this:
link :boom do if @object.can_go_boom? href "the-boom-url" end end
Currently this results in links: {boom: nil} but I'd prefer any links which are nil to be removed (like Hash#compact).
links: {boom: nil}
Hash#compact
Does this make sense? I'd be happy to make a PR if the idea is sound.
The text was updated successfully, but these errors were encountered:
Closing because I found a way to do it:
extend JSONAPI::Serializable::Resource::ConditionalFields link :boom, if: -> { @object.can_go_boom? } do href "the-boom-url" end
Couldn't see it in the docs, came across it here: #49
Sorry, something went wrong.
No branches or pull requests
My use case is to only include possible actions on a resource.
I want to omit ones which aren't relevant, depending on the resource state.
Something like this:
Currently this results in
links: {boom: nil}
but I'd prefer any links which are nil to be removed (likeHash#compact
).Does this make sense? I'd be happy to make a PR if the idea is sound.
The text was updated successfully, but these errors were encountered: