ruby-grape / ruby-grape/grape-entity
Safe behavior (question)
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 729
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
Hi folks. Given the following entity:
expose :name
expose :address
expose :street, safe: true do |instance, _|
instance.address.street
end
end
If address is nil, safe: true is supposed to make street return nil instead of an exception? It's returning undefined method street for nil:NilClass.
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
Reproduce the Ruby entity example from the issue first, then locate the implementation and tests for the safe option. Confirm whether safe: true is intended to guard the nested instance.address.street call; done when the expected behavior is established and covered by a regression test or the issue is clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100