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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -