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

added support for optional_attributes #117

Merged
merged 1 commit into from
Feb 4, 2015
Merged

Conversation

GavinJoyce
Copy link
Contributor

This adds support for optional attributes:

class PersonSerializer
    include RestPack::Serializer

    attributes :id, :name
    optional :description
end

By default, description won't be serialized. To force inclusion:

PersonSerializer.as_json(album, { include_description?: true })

closes #116

TODO:

  • Update the readme

/fyi @eugeneius

GavinJoyce added a commit that referenced this pull request Feb 4, 2015
added support for optional_attributes
@GavinJoyce GavinJoyce merged commit 9ccc090 into master Feb 4, 2015
@GavinJoyce GavinJoyce deleted the gj/attribute-options branch February 4, 2015 21:31
@eugeneius
Copy link
Collaborator

awesome 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the default value of include_xyz? to be specified easily
2 participants