LoginSignup
4
4

More than 1 year has passed since last update.

link_to をブロックで囲って each で回す方法(link_to do ~ end)

Last updated at Posted at 2019-11-15
user/index.html.rb
<% @users.each |user| do %>
  <%= link_to user_path(user) do %>
      <%= @user.name %>
  <% end %>
<% end %>

上記のように、link_to do〜end で囲えば良い。

4
4
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
4
4