Ruby / Rails - links ( full element ) to Show Edit Destroy Delete records in view *.erb


/ Published in: Ruby
Save to your folder(s)

links (full <a href="#"> element) to Show Edit Destroy Delete records in view *.erb
must be in the record loop:


Copy this code and paste it in your HTML
  1. <% @colors.each do |color| %>
  2.  
  3. <table>
  4. <tr>
  5. <td><%= link_to 'Show', color %></td>
  6. <td><%= link_to 'Edit', edit_color_path(color) %></td>
  7. <td><%= link_to 'Destroy', color, :confirm => 'Are you sure?', :method => :delete %></td>
  8. </tr>
  9. </table>
  10.  
  11. <% end %>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.