active_model_serializers

https://github.com/rails-api/active_model_serializers

Ruby

ActiveModel::Serializer implementation and Rails hooks

ActiveModelSerializers::Adapter::JsonApi#links_for

{http://jsonapi.org/format/#document-links Document Links}
links
definition:
 JSON Object

properties:
  self    : URI
  related : link

description:
  A resource object **MAY** contain references to other resource objects ("relationships").
  Relationships may be to-one or to-many. Relationships can be specified by including a member
  in a resource's links object.

  A `self` member’s value is a URL for the relationship itself (a "relationship URL"). This
  URL allows the client to directly manipulate the relationship. For example, it would allow
  a client to remove an `author` from an `article` without deleting the people resource
  itself.
structure:
  {
    self: 'http://example.com/etc',
    related: link
  }.reject! {|_,v| v.nil? }

Source | Google | Stack overflow

Edit

git clone [email protected]:rails-api/active_model_serializers.git

cd active_model_serializers

open lib/active_model_serializers/adapter/json_api.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-ActiveModelSerializers--Adapter--JsonApi-links_for-for-pr


# Commit to git

git add lib/active_model_serializers/adapter/json_api.rbgit commit -m "better docs for ActiveModelSerializers::Adapter::JsonApi#links_for"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-ActiveModelSerializers--Adapter--JsonApi-links_for-for-pr

hub pull-request


# Celebrate!