ruby-grape / ruby-grape/grape-entity
No documentation for creating associated record from grape entity documentation
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 729
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named in the issue. Start by reviewing the existing entity documentation guidance and the Event/Setting examples provided; document how associated setting fields should be represented during event creation, with a complete example that lets a newcomer determine the request shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100