我正在查找结帐控制器(https://github.com/spree/spree/blob/0-60-stable/core/app/controllers/checkout_controller.rb)的源代码,但在那里找不到编辑操作。它在哪里定义?
CheckoutController 有一个隐含的编辑操作。编辑本身没有直接的逻辑。
但是,before_filter :load_order 反过来会触发 before_[state] 回调方法,具体取决于签出所处的状态。
Spree::CheckoutController 中没有编辑操作,但它会呈现 checkout/edit.html.erb。引用超类操作。以下参考来自狂欢文档
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 使用 gem - https://github.com/jamesgolick/resource_controller resource_controller,因此未在 Spree 代码中定义的操作可能会在resource_controller中运行。