新手问题 路由的 root_path 问题

wdrsam · October 19, 2015 · Last by zoker replied at October 21, 2015 · 1571 hits

2 个不同到项目里,都用到 root_path 在前端页面里,一个直接访问'/'根目录,就到首页里,一个点击后到里'/root_path',路由也设置成一样到,到底所哪里有问题?

路由里加了 root to: 'static_pages#index',应该就多了 2 个辅助方法 root_path 和 root_url 啊。但为什么会出现上面到情况?

<%= link_to "Provider List", 'root_path', id:"logo" ,class: "brand"%>

前端是这样的,另外一个跳转正常到项目也是一样的.....

root_path 去掉引号

用 rake routes 看看你的 root_path 路由指向,还有 root_path 是一个 helper 注意书写方式

你应该对比下两个项目的这个用法有什么不同的

You need to Sign in before reply, if you don't have an account, please Sign up first.