编辑Checkout控制器的操作

时间:2011-05-07 16:37:33

标签: ruby-on-rails ruby-on-rails-3 spree

我正在查看Checkout控制器的源代码(https://github.com/spree/spree/blob/0-60-stable/core/app/controllers/checkout_controller.rb)并且没有在那里找到编辑操作。在哪里定义?

3 个答案:

答案 0 :(得分:5)

CheckoutController有隐含的编辑操作。编辑本身没有直接的逻辑。

然而,before_filter:load_order会依次触发before_ [state]回调方法,具体取决于结帐所处的状态。

答案 1 :(得分:0)

Spree使用resource_controller gem - https://github.com/jamesgolick/resource_controller,因此可以在resource_controller中运行未在Spree代码中定义的操作。

答案 2 :(得分:0)

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.