active_model_serializers

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

Ruby

ActiveModel::Serializer implementation and Rails hooks

ActiveModel::Serializer::Lint::Tests#test_as_json

Passes if the object responds to <tt>as_json</tt> and if it takes
zero or one arguments.
Fails otherwise.

<tt>as_json</tt> returns a hash representation of a serialized object.
It may delegate to <tt>serializable_hash</tt>
Typically, it is implemented either by including ActiveModel::Serialization
which includes ActiveModel::Serializers::JSON.
or by the JSON gem when required.

Source | Google | Stack overflow

Edit

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

cd active_model_serializers

open lib/active_model/serializer/lint.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-ActiveModel--Serializer--Lint--Tests-test_as_json-for-pr


# Commit to git

git add lib/active_model/serializer/lint.rbgit commit -m "better docs for ActiveModel::Serializer::Lint::Tests#test_as_json"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-ActiveModel--Serializer--Lint--Tests-test_as_json-for-pr

hub pull-request


# Celebrate!