1
url是mysite.com/lists/student其中lists是在重定向到rails應用程序的子域上安裝的rails應用程序。這些導軌2路線應該如何在導軌3中看起來像?
軌道2:
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
map.connect "student", :controller => 'student', :action => 'index'
鋼軌3我已經試過這些:
match "/student/" => "student#index"
match 'student/:id', :to => 'student#index'
match ':controller(/:action(/:id))(.:format);
,但不工作。
「耙路」沒有輸出。
「'rake routes' does not output」你的意思是沒有輸出嗎?在這種情況下,您可能沒有正確遷移您的項目。看看這篇文章:http://x-aeon.com/wp/2012/12/19/migrating-big-applications-from-rails-2-to-rails-3/ – Miotsu
無論如何,「匹配」學生「=>」students#index「'應該可以工作。 – Miotsu
我很喜歡使用rails_upgrade插件來簡化遷移,但我在共享主機解決方案中,並且認爲我沒有權限更改ruby版本,因此無法從1.9.3切換回1.8。我更新了.bashrc和.bash_profile指向1.8,但ruby版本停留在1.9.3。 –