开发者

rails 3 routing to root my app

开发者 https://www.devze.com 2023-03-14 03:25 出处:网络
I my root url of my app is home/index, but if I\'ll click on link for root of my app, I have in body of that link :control开发者_如何学Pythonler => \'home\', :action => \'home\' - and that means, that

I my root url of my app is home/index, but if I'll click on link for root of my app, I have in body of that link :control开发者_如何学Pythonler => 'home', :action => 'home' - and that means, that after click on this link I'll redirect to root and url address I'll have myapp.com/home/index. And I would like to have there only myapp.com.

I am looking to solution and I found root_url -- but if I'll use this helper,

<%= link_to 'Back to root', :root_url %>

I'll get an error undefined method `root_url_path' -- I would like to ask you, how is possible to define this helper, what everything is need for using this helper?

Thank you and nice a rest of weekend :)


Try:

<%= link_to 'Back to root', root_url %>

... root_url should be a method call and not a symbol


You're almost there, though it's not :root_url, just :root

<%= link_to 'Back to root', :root %>
0

精彩评论

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