Skip to content

Instantly share code, notes, and snippets.

@JoeyBy
Last active June 3, 2016 19:54
Show Gist options
  • Save JoeyBy/b18ae0cf06627758e1d93f6ba9815173 to your computer and use it in GitHub Desktop.
Save JoeyBy/b18ae0cf06627758e1d93f6ba9815173 to your computer and use it in GitHub Desktop.
<section>
<!--creates an <a> tag around the text "new task" and points it to eh new_task_path defined in our routes -->
<%= link_to "new task", new_task_path %>
<!--loops through each of the tasks returned from the database and passed to the view from the tasks_controller index action -->
<% @tasks.each do |task| %>
<!-- for each task put the title in an h3 tag -->
<h3><%= task.title %></h3>
<!-- for each task put the description in a p tag -->
<p><%= task.description %></p>
<!-- for each task add a delete button that uses the DELETE Http method (GET is default for link_to helper methods) -->
<%= link_to "delete", task_path(task), method: :delete, data: {confirm: "Are you sure?"} %>
<% end %>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment