link_toで/:idのリンクを作る
URLが/user/:idの詳細ページへのリンクを作りたい
controllerでユーザーのIDを取得
user_controller.rb
def show
@user = User.find(current_user.id)
end
IDは@userに入る
user.html.erb
<% link_to('Show', user_path(@user)) %>
user.html.erb
<% link_to('Show', user_path(current_user.id)) %>
とも書くことができた。