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 %>
精彩评论