Sha256: 5674c71273ddb974491eb8693677fdd93375cd2b405198136f5525b2f62379bb

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'

module Resources
  class Book < Resources::Base
    model ::ActiveBook

    filters_mapping(
      name: :simple_name
    )

    order_mapping(
      name: 'simple_name',
      writer: 'author'
    )

    # Make name go through another nested property, before getting to simple_name
    property :name, dependencies: [:nested_name]
    def name
      nested_name
    end

    property :nested_name, dependencies: [:simple_name]
    def nested_name
      record.simple_name
    end

    property_group :grouped, ::Book

    property :grouped_id, dependencies: [:id]
    def grouped_id
      id
    end

    property :grouped_name, dependencies: [:name]
    def grouped_name
      name
    end

    property :grouped_moar_tags, as: :tags
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
praxis-2.0.pre.33 spec/spec_app/app/resources/book.rb
praxis-2.0.pre.32 spec/spec_app/app/resources/book.rb
praxis-2.0.pre.31 spec/spec_app/app/resources/book.rb
praxis-2.0.pre.30 spec/spec_app/app/resources/book.rb