-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make PaymentsHelper available to Order views #1496
Conversation
The `confirm` screen shows the payments info[1]. This uses[2] the helper `payment_method_name`[3] without explicitly indicating that controller is using that helper. In many Rails apps, this may be ok due to `config.action_controller.include_all_helpers` defaulting to `true`. But if the application has configured this to be `false` the confirm screen breaks. I am personally a fan of the old Rails behavior (i.e. don't put all helpers in a big pile but make separate helper modules actually mean something). Even though it is the old behavior it is still supported behavior by Rails so it seems an effort to work either way should be made. 1. https://github.com/solidusio/solidus/blob/master/backend/app/views/spree/admin/orders/confirm.html.erb#L54 2. https://github.com/solidusio/solidus/blob/master/backend/app/views/spree/admin/payments/_list.html.erb#L22 3. https://github.com/solidusio/solidus/blob/master/backend/app/helpers/spree/admin/payments_helper.rb#L4
👍 for explicitness. I agree about not wanting to include all helpers in all controllers -- things get very messy on large apps when you do that. |
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.
Thanks Eric. Works for me.
It would be nice if we could eventually support include_all_helpers=false
across the entire application.
Agreed. Unfortunately my upstream commits are limited to just stuff I hit while working on my primary goal. Systematically going through all screens to make sure everything is |
The [backend/app/views/spree/admin/variants/_form.html.erb](https://github.com/solidusio/solidus/blob/master/backend/app/views/spree/admin/variants/_form.html.erb#L73) now uses a helper method called `show_rebuild_vat_checkbox?` which is defined in [Spree::Admin::ProductsHelper](https://github.com/solidusio/solidus/blob/master/backend/app/helpers/spree/admin/products_helper.rb#L28). This helper is not automatically included if `config.action_controller.include_all_helpers` is configured to false. See [PR solidusio#1496](solidusio#1496) for rational and previous discussion on this topic.
Another fix to make Solidus `config.action_controller.include_all_helpers = false` compatible. See PR solidusio#1496 and PR solidusio#1714 for background.
The
confirm
screen shows the payments info. This uses the helperpayment_method_name
without explicitly indicating that controller is using that helper.In many Rails apps, this may be ok due to
config.action_controller.include_all_helpers
defaulting totrue
. But if the application has configured this to befalse
the confirm screen breaks. I am personally a fan of the old Rails behavior (i.e. don't put all helpers in a big pile but make separate helper modules actually mean something). Even though it is the old behavior it is still supported behavior by Rails so it seems an effort to work either way should be made.