开发者

How can I set default parameter value in routing in rails 3

开发者 https://www.devze.com 2023-03-31 11:58 出处:网络
How can I set default parameter value in routing in Rails 3. For example I have this route match \':slu开发者_运维问答g/:id/:direction\' => \'quiz#show\', :as => :quiz_details, :direction =>

How can I set default parameter value in routing in Rails 3. For example I have this route

match ':slu开发者_运维问答g/:id/:direction' => 'quiz#show', :as => :quiz_details, :direction => "next"

and I want to default the value of direction to next.


match ':slug/:id/:direction' => 'quiz#show', :as => :quiz_details, :defaults => { :direction => "next" }

More details in the official Rails guides.

0

精彩评论

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