active_model_serializers

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

Ruby

ActiveModel::Serializer implementation and Rails hooks

ActiveModelSerializers::Adapter::JsonApi#resource_objects_for

{http://jsonapi.org/format/#document-resource-objects Primary data}
resource
definition:
  JSON Object

properties:
  type (required) : String
  id   (required) : String
  attributes
  relationships
  links
  meta

description:
  "Resource objects" appear in a JSON API document to represent resources
structure:
  {
    type: 'admin--some-user',
    id: '1336',
    attributes: attributes,
    relationships: relationships,
    links: links,
    meta: meta,
  }.reject! {|_,v| v.nil? }
prs:
  type
    https://github.com/rails-api/active_model_serializers/pull/1122
    [x] https://github.com/rails-api/active_model_serializers/pull/1213
    https://github.com/rails-api/active_model_serializers/pull/1216
    https://github.com/rails-api/active_model_serializers/pull/1029
  links
    [x] https://github.com/rails-api/active_model_serializers/pull/1246
    [x] url helpers https://github.com/rails-api/active_model_serializers/issues/1269
  meta
    [x] https://github.com/rails-api/active_model_serializers/pull/1340

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-resource_objects_for-for-pr


# Commit to git

git add lib/active_model_serializers/adapter/json_api.rbgit commit -m "better docs for ActiveModelSerializers::Adapter::JsonApi#resource_objects_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-resource_objects_for-for-pr

hub pull-request


# Celebrate!