-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
with_content for ViewComponent flagged as dynamic render path #1832
Comments
I've managed to put together what's potentially a patch for this. Code below: def renderable? exp
return false unless call?(exp)
if exp.method == :with_content
exp = exp.target
end
return false unless constant?(exp.target)
target_class_name = class_name(exp.target)
known_renderable_class?(target_class_name) or tracker.find_method(:render_in, target_class_name)
end This looks to handle the cases of |
That works and would probably be how I'd do it, too. |
And maybe one day make this check optional. |
@presidentbeef awesome, I'll PR it in. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
Brakeman version: 5.4.1
Rails version: 6.1.7.6
Ruby version: 2.7.7p221
Link to Rails application code: N/A
Issue
When rendering a
ViewComponent
via thewith_content
method a Dynamic Render Path warning will be raised. However, using the block version, the warning is not raised. Example using the basic implementation for a view component:My debugging has lead me to the
renderable?
method, and it appears like it's missing logic to detect thewith_content
usage of this pattern.The text was updated successfully, but these errors were encountered: