ruby - How to refer to root path in Sinatra views -
is there way refer root url of sinatra app? in 1 of views i'd following:
<a href="<%= root_path/cats %>">show cats</a>
does sinatra provide magic helper root_path
or it's equivalent?
there uri
helper
#uri(addr = nil, absolute = true, add_script_name = true) ⇒ object
also known as:
url
,to
generates absolute uri given path in app. takes rack routers , reverse proxies account.
for example:
<a href="<%= uri('/cats') %>">show cats</a>
Comments
Post a Comment