1
假設我有一個名爲invoice的對象。在routes.rb
我奇異路由服務參數:object_id而不是:id
resources :invoices do
get "pay"
end
當我運行rake routes
,路線作爲
invoice_pay GET /invoices/:invoice_id/pay(.:format) invoices#pay
生成和參數是:invoices_id
而不是:id
如果我用一根火柴聲明:
match "invoices/:id/pay" => "invoices#pay", :via => :get
我得到:
GET /invoices/:id/pay(.:format) invoices#pay
在我看來,該航線應該是pay_invoice_path(@invoice)
,但是,我還沒有找到適合此文檔。有什麼建議麼?
正是我一直在尋找。謝謝! – Kosmonaut 2013-02-17 22:46:33