【发布时间】:2013-05-04 00:41:39
【问题描述】:
我刚刚使用 public/index.html 实现了一个新主页,我读到它覆盖了很多路由。
我最初拥有root to: static_pages#home,如果用户已登录,则在我的static_pages\home.html.erb 视图中,如果用户未登录,他们会看到已登录的主页和匿名访问者 (public/index.html) 主页。
在实现 public/index.html 后,我为登录用户创建了一条新路由,并将之前的 root_path 重定向到 home_path
get '/home' => 'static_pages#home', :as => :home
但是,我想使用http://localhost:3000 作为登录和访问者主页的主页。这可能吗?如何让访问者看到当前运行良好的当前 public/index.html,但登录后不必使用http://localhost:3000/home?登录后我也想要http://localhost:3000。
谢谢
【问题讨论】:
-
您需要对其进行编码或查找某人制作的过滤器,该过滤器会根据登录的 cookie 状态更改包含的内容。
标签: ruby-on-rails ruby routes public-html