Skip to content

Instantly share code, notes, and snippets.

@dingeuwen
Created April 13, 2013 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingeuwen/5380477 to your computer and use it in GitHub Desktop.
Save dingeuwen/5380477 to your computer and use it in GitHub Desktop.
<p id="notice"><%= notice %></p>
<p>
<b>ID:</b>
<%= @product.id %>
</p>
<p>
<b>Name:</b>
<%= @product.name %>
</p>
<p>
<b>Price:</b>
<%= @product.price %>
</p>
<p>
<b>Description:</b>
<%= @product.description %>
</p>
<p>
<b>Product picture:</b>
<%= @product.product_picture %>
</p>
<p>
<b>In cart:</b>
<%= @product.in_cart %>
</p>
<p>
<b>Existing reviews:</b>
<% @review.each do |a_review| %>
<p>Review ID: <%= a_review.id %></p>
<p> <%= a_review.body %></p>
<% end %>
</p>
<form action='/reviews/new' method='get'>
<input type='hidden' value="<%= @product.id %>" name='product_id'/>
<button type="submit">Write your review for <%= @product.name %></button>
<% if @product.in_cart == false %>
<form action='/products/<%= @product.id %>' method='put'>
<input type='hidden' value="<%= true %>" name='product_in_cart'/>
<button type="submit">Add to cart</button>
<% elsif @product.in_cart == true %>
<form action='/products/<%= @product.id %>' method='put'>
<input type='hidden' value="<%= false %>" name='product_in_cart'/>
<button type="submit">Remove from cart</button>
<% end %>
<%= link_to 'Edit', edit_product_path(@product) %> |
<%= link_to 'Back', products_path %>
<%= render 'cart' %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment