开发者

Rails 3 routing - passing params from routes.rb

开发者 https://www.devze.com 2023-01-12 23:40 出处:网络
In rails 2.3.5 you could do something like this inside the routes.rb file: map.root :controller => \"pages\", :action => \"show\", :id => 3

In rails 2.3.5 you could do something like this inside the routes.rb file:

map.root :controller => "pages", :action => "show", :id => 3

In rails 3 I haven't found any way to pass a specific parameter 开发者_运维知识库(like in rails 2.3.5 with :id => 3).

I know I can handle it from the controller and have the same result (which I did), but I was wondering if there is a way to do the same thing in rails 3 from the routes.rb or has it changed because it is better practice for some reason?


Are you sure the following doesn't work?

root :to => "pages#show", :id => 3
0

精彩评论

暂无评论...
验证码 换一张
取 消