-
Notifications
You must be signed in to change notification settings - Fork 255
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
Use the helper context methods or constructing action routes #2595
Conversation
50e78e8
to
5f9e131
Compare
Can you explain why we need this change? Doesn't view_components already include the routes? https://github.com/github/view_component/blob/8d284a08a963fe3c5e7587da73f5d9906c7e7937/lib/view_component/base.rb#L370 |
blacklight-marc does its own thing: https://github.com/projectblacklight/blacklight-marc/blob/master/app/helpers/blacklight_marc_helper.rb#L8-L17 🤷♂️ |
Can you drop that in a comment so we don't accidentally factor it out later? |
5f9e131
to
4898c69
Compare
elsif url_opts[:id].class.respond_to?(:model_name) | ||
url_for([@action.key.to_sym, url_opts[:id]]) | ||
helpers.url_for([@action.key.to_sym, url_opts[:id]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to delegate to helpers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes? At least for now, until we sort out a better way for plugins like blacklight-marc (above) to do its thing.
else | ||
public_send("#{@action.key}_#{controller_name}_path", url_opts) | ||
helpers.public_send("#{@action.key}_#{helpers.controller_name}_path", url_opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need helpers.controller_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. There's no such method in scope here.
No description provided.