开发者

How do you have the create Action route to an alternative model name?

Routes.rb

resources :recovers match ':开发者_StackOverflowcheckedin' => 'recovers#index' match ':checkin/:id' => 'recovers#show'

When a new record is created Rails routes the user to /recovers, I would like the user to be routed to /checkedin how do I do this?


You could do the following:

routes.db:

resources :recovers
match 'checkedin' => 'recovers#index', :as => 'checkedin'
match 'checkin/:id' => 'recovers#show'

recovers_controller.rb: in the create method:

redirect_to checkedin_path
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜