2012-05-19 90 views
0

我有這樣的路線:軌道3路由路徑構建問題

在瀏覽器http://127.0.0.1:3000/inv/user_templates/6/download/12?locale=uk,它的工作原理。

但我該如何構建資源路徑?

我想:

download_user_template_path(params[:property], @id, @idcreated) 

,但我得到的消息:

No route matches {:action=>"download", :controller=>"user_templates", :locale=>:uk, :property=>"inv", :id=>76, :format=>6} 

它沒有工作過:

download_user_template_path('property' => params[:property], 'id' => @tmp_id, 'idcreated' => @created_temp_row[:id])

rake routes 

        GET /:property/user_templates/:id/download/:idcreated(.:format) {:property=>/inv|um|tm|pp/, :action=>"download", :controller=>"user_templates"} 
    user_templates GET /:property/user_templates(.:format){:property=>/inv|um|tm|pp/, :action=>"index", :controller=>"user_templates"} 
        POST /:property/user_templates(.:format){:property=>/inv|um|tm|pp/, :action=>"create", :controller=>"user_templates"} 
new_user_template GET /:property/user_templates/new(.:format){:property=>/inv|um|tm|pp/, :action=>"new", :controller=>"user_templates"} 
edit_user_template GET /:property/user_templates/:id/edit(.:format){:property=>/inv|um|tm|pp/, :action=>"edit", :controller=>"user_templates"} 
    user_template GET /:property/user_templates/:id(.:format){:property=>/inv|um|tm|pp/, :action=>"show", :controller=>"user_templates"} 
        PUT /:property/user_templates/:id(.:format){:property=>/inv|um|tm|pp/, :action=>"update", :controller=>"user_templates"} 
        DELETE /:property/user_templates/:id(.:format){:property=>/inv|um|tm|pp/, :action=>"destroy", :controller=>"user_templates"} 

任何幫助PLZ?

+0

是什麼'耙routes'顯示有問題的路線? – x1a4

+0

我編輯了我的問題 –

回答

1

只需添加:如=>:下載,並使用耙路線CONTROLLER = ...

+0

非常感謝,它的工作原理! –