小编sid*_*idj的帖子

Rails路由基于条件

我有三个角色:Instuctor,Student,Admin,每个角色都有一个带有"home"视图的控制器.

所以这很好,

get "instructor/home", :to => "instructor#home"
get "student/home", :to => "student#home"
get "admin/home", :to => "admin#home"
Run Code Online (Sandbox Code Playgroud)

我想写一个类似于下面的虚荣网址,它会根据user_id正确的主页的角色进行路由.

get "/:user_id/home", :to => "instructor#home" or "student#home" or "admin#home"
Run Code Online (Sandbox Code Playgroud)

我该如何做到这一点?

routes ruby-on-rails rails-routing ruby-on-rails-3 ruby-on-rails-3.2

17
推荐指数
2
解决办法
1万
查看次数

如何生成如图所示的拼贴图像

如何生成如下所示的拼贴图像。如果您能告诉我是否有任何在线工具或应用程序可以做到这一点,我将不胜感激。谢谢!

在此处输入图片说明

photo image photo-gallery

4
推荐指数
2
解决办法
1838
查看次数