LoginSignup
0
0

More than 3 years have passed since last update.

Rails aタグのリンクに変数を入れる方法

Posted at

リンクを書く際になんども調べる事が多いので、備忘録として…

users/:id/showへのリンクをaタグを使って書きたい場合…

<a href="/users/<%= @user.id %>/show">

※Rubyの場合(二重引用符" "の中で式展開)

<%= link_to "詳細", "/users/#{@user.id}/show" %>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0