ruby / ruby/gem_rbs_collection
`ActionView::Helpers::RenderingHelper#render` has incorrect block signature
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 303
- Forks
- 136
- Avg merge
- 5h 15m
- Merged PRs (30d)
- 6
Description
When calling the #render method from a helper in a Rails app, for example:
module ApplicationHelper
def render_partial(name, options)
render(partial: name, **options)
end
end
the current type definitions throw an error when validating in Steep due to an incorrect signature:
rbs:
module ApplicationHelper : ActionView::Helpers
def render_partial: (String name, Hash[Symbol, untyped] options) -> String
end
steep output:
[error] The method cannot be called without a block
│ Diagnostic ID: Ruby::RequiredBlockMissing
│
└ render(
~~~~~~
This specific one comes from ActionView::Helpers::RenderingHelper#render, which is defined on https://github.com/ruby/gem_rbs_collection/blob/main/gems/actionview/6.0/actionview-generated.rbs#L6603
def render: (?::Hash[untyped, untyped] options, ?::Hash[untyped, untyped] locals) { () -> untyped } -> untyped
The patch to fix it is to make the block optional, ie ?{ () -> untyped }
I'm happy to make a PR to address, but not sure if you would prefer to update the generated files or the patch.
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
Start at gems/actionview/6.0/actionview-generated.rbs around the ActionView::Helpers::RenderingHelper#render definition. Compare the generated file with the patching workflow to determine whether the change belongs in the generated RBS or its source patch, then validate the corrected signature with Steep using the helper example. Done means the helper call no longer reports Ruby::RequiredBlockMissing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100