Skip to content

v0.5.8

Compare
Choose a tag to compare
@GavinJoyce GavinJoyce released this 04 Feb 21:42
· 81 commits to master since this release

Changes:

Optional attributes: #117

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 })

Hash models: #118

Previously RestPack::Serializer only supported objects as models. If your models are a Hash, there is not longer any need for serializer methods such as:

def name
  @model[:name]
end