2
我正在將應用程序從Rails 2.3.5遷移到Rails 3.2.8。 我從軌道2應用程序,是給我頭疼的這條路線:如何將根特定的資源聲明從Rails 2轉換爲Rails 3?
map.resources :soumission_vt,
:path_prefix => "/soumission/VT/:page_id", :as => 'police/:action/:id',
:requirements => {:page_id => /\S+/}
至極生成以下內容:
soumission_vt_index GET /soumission/VT/:page_id/police/:action/:id(.:format) {:controller=>"soumission_vt"}
POST /soumission/VT/:page_id/police/:action/:id(.:format) {:controller=>"soumission_vt"}
new_soumission_vt GET /soumission/VT/:page_id/police/:action/:id/new(.:format) {:controller=>"soumission_vt"}
edit_soumission_vt GET /soumission/VT/:page_id/police/:action/:id/:id/edit(.:format) {:controller=>"soumission_vt"}
soumission_vt GET /soumission/VT/:page_id/police/:action/:id/:id(.:format) {:controller=>"soumission_vt"}
PUT /soumission/VT/:page_id/police/:action/:id/:id(.:format) {:controller=>"soumission_vt"}
DELETE /soumission/VT/:page_id/police/:action/:id/:id(.:format) {:controller=>"soumission_vt"}
我把它翻譯這樣Rails中3:
scope '/soumission/VT/:page_id', :constraints => {:page_id => /\S+/} do
resources :soumission_vt, :as => 'police/:action/:id'
end
但我得到一個無效路由名稱:'警察/:行動/:id_index'...
那麼有沒有辦法在Rails 3中重現這些路線?
謝謝!