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

Add support for toplevel JSON API links. #1247

Merged
merged 1 commit into from
Oct 10, 2015

Conversation

beauby
Copy link
Contributor

@beauby beauby commented Oct 6, 2015

As an adapter option:

render json: posts, links: { self: { href: "http//api.domain.com/posts" } }

@@ -1,7 +1,7 @@
require 'set'
module ActiveModel
class SerializableResource
ADAPTER_OPTION_KEYS = Set.new([:include, :fields, :adapter, :meta, :meta_key])
ADAPTER_OPTION_KEYS = Set.new([:include, :fields, :adapter, :meta, :meta_key, :links])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! shouldn't this integrate with existing code such as pagination links?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, pagination is automagically added anyways. I'm up for any suggestion though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but would both work well together? What do you think about adding a test covering it? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the pagination stuff just updates the links.

@NullVoxPopuli
Copy link
Contributor

👍

@joaomdmoura
Copy link
Member

Just one small comments, would be nice to have this test IMO. Other then this it LGTM

@joaomdmoura
Copy link
Member

LGTM then, merging it.

joaomdmoura added a commit that referenced this pull request Oct 10, 2015
Add support for toplevel JSON API links.
@joaomdmoura joaomdmoura merged commit da7e6dc into rails-api:master Oct 10, 2015
leandrocp added a commit to leandrocp/active_model_serializers that referenced this pull request Dec 23, 2015
leandrocp added a commit to leandrocp/active_model_serializers that referenced this pull request Dec 23, 2015
update according rubocop rules
leandrocp added a commit to leandrocp/active_model_serializers that referenced this pull request Feb 3, 2016
update according rubocop rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants