我有两条路。
checkout GET /checkout/:product_id(.:format) checkout#new
POST /checkout(.:format) checkout#create
我希望在发布命令中使用checkout_path
,但是由于某种原因,如果我使用checkout_path()
,它将始终返回获取路径。
/checkout/some_id
vs
/checkout
get "welcome" => "checkout#show"
get "checkout/:product_id" => "checkout#new", :as => :checkout
post "checkout" => "checkout#create"
答案 0 :(得分:0)
checkout_path
助手来自您的:as => :checkout
,所以:
get "welcome" => "checkout#show"
get "checkout/:product_id" => "checkout#new", as: :some_other_name
post "checkout" => "checkout#create", as: :checkout