Sha256: e737dc81e11ac9271e578123463d78a917acab47422b03b81d5384d79c54b71a

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

module MyApp
  class SongSerializer
    include RestPack::Serializer
    attributes :id, :title, :album_id
    can_include :albums, :artists
    can_filter_by :title
    can_sort_by :id, :title

    def title
      @context[:reverse_title?] ? @model.title.reverse : @model.title
    end
  end

  class AlbumSerializer
    include RestPack::Serializer
    attributes :id, :title, :year, :artist_id
    can_include :artists, :songs
    can_filter_by :year
  end

  class AlbumReviewSerializer
    include RestPack::Serializer
    attributes :message
    can_filter_by :album
  end

  class ArtistSerializer
    include RestPack::Serializer
    attributes :id, :name, :website
    can_include :albums, :songs
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_serializer-0.4.27 spec/fixtures/serializers.rb