Skip to content

Instantly share code, notes, and snippets.

@catm705
Created April 20, 2014 22:08
Show Gist options
  • Save catm705/11126493 to your computer and use it in GitHub Desktop.
Save catm705/11126493 to your computer and use it in GitHub Desktop.
link_to
<!-- views/picture/index.html.erb -->
<% if flash[:msg] %>
<%= flash[:msg] %>
<% end %>
<br>
<%= link_to "create picture", new_picture_path(@picture) %>
<br>
<br>
<% @pictures.each do |picture| %>
<img src="<%= picture.image_url %>" alt="" width="300px"/>
<p><strong><%= picture.description %> </strong></p>
<%= link_to "show picture", picture_path(picture) %>
<br>
<%= link_to "edit picture", edit_picture_path(picture)%>
<br>
<%= link_to "Delete", picture_path(picture), method: :delete %>
<br>
<%= link_to "delete picture", { action: :destroy, id: picture.id}, method: :delete %>
<br>
<br>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment