Guest User

Untitled

a guest
Jan 15th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <% @products.each do |product| %>
  2. <div class="entry">
  3. <%= image_tag(product.image_url) %>
  4. <h3><%= product.title %></h3>
  5. <%= sanitize(product.description) %>
  6. <div class="price_line">
  7. <span class="price"><%= number_to_currency(product.price, unit: '$') %></span>
  8. <%= button_to 'Add to Cart', line_items_path(product_id: product) %>
  9. </div>
  10. </div>
  11. <% end %>
  12.  
  13. class LineItem < ActiveRecord::Base
  14. attr_accessible :cart_id, :product_id
  15. belongs_to :product
  16. belongs_to :cart
  17. end
  18.  
  19. line_items_path(product)
  20.  
  21. line_items_path(product_id: product)
  22.  
  23. line_items_path(:product_id => product)
  24.  
  25. line_items_path({:product_id => product})
Add Comment
Please, Sign In to add comment