Skip to content

No documentation for creating associated record from grape entity documentation #169

@brahamshakti

Description

@brahamshakti

Hi I don't know how to create an associated record from grape entity for. eg. I have two model Event and Setting and their relation is like event has_one: :setting and setting belongs_to: :event . Now while creating event using

 desc 'Create an event.' ,{
     params: Entities::EventEntity.documentation, type: :create
  }

My entity class is

module Entities
  class EventEntity < Grape::Entity
    expose :id
    expose :name, documentation: { type: String, desc: "Event name", required: true}
    expose :setting, using: Entities::EventSettingEntity
  end
end

and event_setting_entity is

module Entities
  class EventSettingEntity < Grape::Entity
    expose :id, :event_id
    expose :type, documentation: { type: String, desc: "Type" }
  end
end

I am able to create event using documentation but for setting how do I show field for setting. There is no documentation provide for this. Help me please. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions