开发者

(Rails 3) Is it possible to hardcode ids in a named route?

As far as I know, the following is the encouraged way to create a simple named route in Rails 3:

match 'sign-in' =>开发者_开发技巧 'sessions#create', :as => :sign_in

Is there a clean way to hardcode an id (or any parameter) in a named route? For a silly example:

match 'first-user' => 'users#show', :as => :first_user, :id => 1


Did you try that? It just works like that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜