Ruby on railsのテンプレート内でルーティングのパスを取得するには、〇〇〇‗path という書き方を使います。
ルーティングが以下のようになっていたとして。
Rails.application.routes.draw do get '/items/index', to: 'items#index' end
テンプレート側でitems_path とする事で「/items/index」というパスが取得できます。
<h1>items</h1> <%= link_to 'item list', items_path %>
レンダリングされたHTMLは以下のようになる。
<h1>items</h1> <a href="/items">item list</a>