You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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