Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails路线:收集路线不断添加"_索引“;到url帮助器?_Ruby On Rails - Fatal编程技术网

Ruby on rails Rails路线:收集路线不断添加"_索引“;到url帮助器?

Ruby on rails Rails路线:收集路线不断添加"_索引“;到url帮助器?,ruby-on-rails,Ruby On Rails,我正在尝试为我的签出控制器创建额外的路径。以下是我的路线: resources :checkout do collection do post :add_to_cart, :to => 'checkout#add_to_cart' put :update_shopping_cart, :to => 'checkout#update_shopping_cart' get :billing post :update_billing put :u

我正在尝试为我的签出控制器创建额外的路径。以下是我的路线:

resources :checkout do
  collection do
    post :add_to_cart, :to => 'checkout#add_to_cart'
    put :update_shopping_cart, :to => 'checkout#update_shopping_cart'
    get :billing
    post :update_billing
    put :update_billing
    post :update_shipping
    put :update_shipping
    get :order_summary
    post :submit_order
    get :order_complete
    get :clone_shipping_address
    get :estimate_shipping
  end


end
但是,当我执行
bundle exec rake routes | grep checkout
时,我的所有自定义路由都有一个我不想要的_索引后缀:

             add_to_cart_checkout_index POST   /checkout/add_to_cart(.:format)                                 checkout#add_to_cart
    update_shopping_cart_checkout_index PUT    /checkout/update_shopping_cart(.:format)                        checkout#update_shopping_cart
                 billing_checkout_index GET    /checkout/billing(.:format)                                     checkout#billing
          update_billing_checkout_index POST   /checkout/update_billing(.:format)                              checkout#update_billing
                                        PUT    /checkout/update_billing(.:format)                              checkout#update_billing
         update_shipping_checkout_index POST   /checkout/update_shipping(.:format)                             checkout#update_shipping
                                        PUT    /checkout/update_shipping(.:format)                             checkout#update_shipping
           order_summary_checkout_index GET    /checkout/order_summary(.:format)                               checkout#order_summary
            submit_order_checkout_index POST   /checkout/submit_order(.:format)                                checkout#submit_order
          order_complete_checkout_index GET    /checkout/order_complete(.:format)                              checkout#order_complete
  clone_shipping_address_checkout_index GET    /checkout/clone_shipping_address(.:format)                      checkout#clone_shipping_address
       estimate_shipping_checkout_index GET    /checkout/estimate_shipping(.:format)                           checkout#estimate_shipping
                         checkout_index GET    /checkout(.:format)                                             checkout#index
                                        POST   /checkout(.:format)                                             checkout#create
                           new_checkout GET    /checkout/new(.:format)                                         checkout#new
                          edit_checkout GET    /checkout/:id/edit(.:format)                                    checkout#edit
                               checkout GET    /checkout/:id(.:format)                                         checkout#show
                                        PUT    /checkout/:id(.:format)                                         checkout#update
                                        DELETE /checkout/:id(.:format)                                         checkout#destroy

我如何删除它?

您必须将资源的名称复数化:

resources :checkouts do
  ## your routes
end

事实上,您必须使用
资源:签出
资源:签出
,这取决于您需要什么。

您必须将资源的名称复数化:

resources :checkouts do
  ## your routes
end

事实上,您必须使用
资源:签出
资源:签出
,这取决于您需要什么。

您必须将资源的名称复数化:

resources :checkouts do
  ## your routes
end

事实上,您必须使用
资源:签出
资源:签出
,这取决于您需要什么。

您必须将资源的名称复数化:

resources :checkouts do
  ## your routes
end
事实上,您必须使用
资源:签出
资源:签出
,这取决于您需要什么