Skip to content
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

Merged
merged 1 commit into from
Oct 13, 2016

Conversation

eric1234
Copy link
Contributor

@eric1234 eric1234 commented Oct 3, 2016

The confirm screen shows the payments info. This uses the helper payment_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 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.

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
@jasonfb
Copy link

jasonfb commented Oct 3, 2016

👍 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.

Copy link
Contributor

@jhawthorn jhawthorn left a 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.

@eric1234
Copy link
Contributor Author

eric1234 commented Oct 4, 2016

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 include_all_helpers=false happy is beyond my scope. But my config is set to false so if I hit any other screens as I'm hacking will send upstream.

@gmacdougall gmacdougall merged commit cf50896 into solidusio:master Oct 13, 2016
@eric1234 eric1234 deleted the patch-1 branch February 16, 2017 20:25
eric1234 added a commit to eric1234/solidus that referenced this pull request Feb 16, 2017
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.
eric1234 added a commit to eric1234/solidus that referenced this pull request Mar 14, 2017
Another fix to make Solidus `config.action_controller.include_all_helpers = false` compatible.

See PR solidusio#1496 and PR solidusio#1714 for background.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants