Checkout 控制器的编辑操作
我正在查看 Checkout 控制器的源代码 (https://github.com/spree/spree/blob/0-60-stable/core/app/controllers/checkout_controller.rb)并且没有在那里找到编辑操作。它是在哪里定义的?
I'm looking in the source code of the Checkout controller (https://github.com/spree/spree/blob/0-60-stable/core/app/controllers/checkout_controller.rb) and didn't find the edit action there. Where is it defined?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
CheckoutController 有一个隐含的编辑操作。编辑本身没有直接的逻辑。
然而, before_filter :load_order 又会触发 before_[state] 回调方法,具体取决于结账所处的状态。
The CheckoutController has an implied edit action. There's no direct logic for edit itself.
There is however the before_filter :load_order which in turn triggers a before_[state] callback method, depending on which state the checkout is in.
Spree::CheckoutController 中没有编辑操作,但它呈现 checkout/edit.html.erb。参考超类动作。以下来自 spree 文档的参考
编辑操作会渲染 checkout/edit.html.erb 模板,然后该模板会渲染当前状态的部分内容,例如 app/views/spree/checkout/address.html.erb。该部分显示特定于州的字段供用户填写。如果您选择自定义结帐流程以添加新州,则需要为此州创建一个新的部分。
There is no edit action in Spree::CheckoutController but it renders the checkout/edit.html.erb. Reference superclass action. Following reference from spree docs
The edit action renders the checkout/edit.html.erb template, which then renders a partial with the current state, such as app/views/spree/checkout/address.html.erb. This partial shows state-specific fields for the user to fill in. If you choose to customize the checkout flow to add a new state, you will need to create a new partial for this state.
Spree 使用resource_controller gem - https://github.com/jamesgolick/resource_controller,因此未定义的操作Spree中的代码可能在resource_controller中运行。
Spree uses resource_controller gem - https://github.com/jamesgolick/resource_controller, so actions that are not defined in Spree code might be run in the resource_controller.