-
-
Notifications
You must be signed in to change notification settings - Fork 41
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 checkout routes more resource-oriented #272
base: main
Are you sure you want to change the base?
Make checkout routes more resource-oriented #272
Conversation
@@ -0,0 +1,31 @@ | |||
# frozen_string_literal: true | |||
|
|||
module CheckoutHelper |
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.
I intend to convert this to a component in a follow-up PR.
|
||
# non-restful checkout stuff | ||
patch '/checkout/update/:state', to: 'checkouts#update', as: :update_checkout | ||
resource :checkout, only: [:edit, :update] |
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.
Shouldn't be checkouts
as we are proposing for carts
?
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.
This is the Rails convention for declaring a singular resource. As a singular resource, the paths that the route generates does not have the id param e.g. /checkout
instead of checkouts/:id
. However, also by Rails convention, the controller mapped to this route maintains a pluralized name (see templates/app/controllers/checkouts_controller.rb
).
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.
Ah right, sorry!
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.
Hehe.. No worries!
2eb988c
to
bc23b2d
Compare
Goal
As a SolidusStarterFrontend user
I want the checkout routes to be converted to resource routes
So that they fit better into Rails conventions.
Background
This is part of an epic to refactor the order and checkout-related controller. Please see https://docs.google.com/spreadsheets/d/1mV2d4H4Ak9kEvc2bxKUpAv4hiz7FwTUE2t-SfOF7g8E/edit?usp=sharing for the list of changes.
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)[ ] New feature (non-breaking change which adds functionality)[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)Checklist:
[ ] My change requires a change to the documentation.[ ] I have updated the documentation accordingly.