0
直到最近我纔開始遇到這個問題。我有一個完全自定義的RoR電子商務網站,我們剛完成重新設計網站。在這個過程中的某個地方出現了一個路由問題,我似乎無法確定爲什麼現在在沒有問題之前這樣做。RoR路由問題
的URI被視爲:
/orders/295829fb4/items/379
Heroku的日誌吐出這個錯誤:
ActionController::RoutingError (No route matches "/orders/295829fb4/items/379"):
這裏是我的訂單
scope :constraints => { :protocol => (Rails.env.production? ? "https" : "http") } do
resources :orders, :only => [:show, :cart] do
member do
get :cart
end
resources :items, :only => [:create, :update, :destroy], :controller => 'order_items'
resource :address, :only => [:new, :edit, :create, :update]
resource :payment, :only => [:new, :create]
resource :discount, :only => [:create, :destroy]
resource :shipping_method, :only => [:update]
end
end
cart_order GET /orders/:id/cart(.:format) {:protocol=>"https", :controller=>"orders", :action=>"cart"}
order_items POST /orders/:order_id/items(.:format) {:protocol=>"https", :controller=>"order_items", :action=>"create"}
order_item GET /orders/:order_id/items/:id(.:format) {:protocol=>"https", :controller=>"order_items", :action=>"show"}
order_item PUT /orders/:order_id/items/:id(.:format) {:protocol=>"https", :controller=>"order_items", :action=>"update"}
order_item DELETE /orders/:order_id/items/:id(.:format) {:protocol=>"https", :controller=>"order_items", :action=>"destroy"}
order_address POST /orders/:order_id/address(.:format) {:protocol=>"https", :controller=>"addresses", :action=>"create"}
new_order_address GET /orders/:order_id/address/new(.:format) {:protocol=>"https", :controller=>"addresses", :action=>"new"}
edit_order_address GET /orders/:order_id/address/edit(.:format) {:protocol=>"https", :controller=>"addresses", :action=>"edit"}
order_address PUT /orders/:order_id/address(.:format) {:protocol=>"https", :controller=>"addresses", :action=>"update"}
order_payment POST /orders/:order_id/payment(.:format) {:protocol=>"https", :controller=>"payments", :action=>"create"}
new_order_payment GET /orders/:order_id/payment/new(.:format) {:protocol=>"https", :controller=>"payments", :action=>"new"}
order_discount POST /orders/:order_id/discount(.:format) {:protocol=>"https", :controller=>"discounts", :action=>"create"}
order_discount DELETE /orders/:order_id/discount(.:format) {:protocol=>"https", :controller=>"discounts", :action=>"destroy"}
order_shipping_method PUT /orders/:order_id/shipping_method(.:format) {:protocol=>"https", :controller=>"shipping_methods", :action=>"update"}
order GET /orders/:id(.:format) {:protocol=>"https", :controller=>"orders", :action=>"show"}
你也可以發佈'rake routes'的輸出嗎? – jefflunt
rake routes | grep order – Anatoly
添加了與訂單有關的耙路線。 – Marcus