/ Published in: Ruby
links (full <a href="#"> element) to Show Edit Destroy Delete records in view *.erb
must be in the record loop:
must be in the record loop:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<% @colors.each do |color| %> <table> <tr> <td><%= link_to 'Show', color %></td> <td><%= link_to 'Edit', edit_color_path(color) %></td> <td><%= link_to 'Destroy', color, :confirm => 'Are you sure?', :method => :delete %></td> </tr> </table> <% end %>