Skip to content
Browse files

fixed how ordering works

  • Loading branch information...
1 parent 7c74cc2 commit 25061328eaecd46a69a99e5b481328b7567da3b6 @SpinnakerSix SpinnakerSix committed
View
3 app/assets/stylesheets/custom.css.scss
@@ -0,0 +1,3 @@
+textarea{
+ height:10em;
+}
View
1 app/controllers/orders_controller.rb
@@ -1,5 +1,6 @@
class OrdersController < ApplicationController
def new
+ @place = Place.find(params[:place_id])
end
def show
View
9 app/views/orders/new.html.haml
@@ -1,2 +1,9 @@
%h1 Orders#new
-%p Find me in app/views/orders/new.html.haml
+%p Find me in app/views/orders/new.html.haml
+
+
+= form_for @order do |o|
+ =o.hidden_field :product_id,@product.id
+ =o.hidden_field :place_id, @place.id
+ =o.submit 'Confirm Purchase'
+
View
6 app/views/places/show.html.haml
@@ -1,9 +1,8 @@
-%h1 Places#show
-
%h1
Welcome to
=@place.name
+%h3 Menu
.menu
%table{:class=>'table'}
- @place.products.each do |p|
@@ -14,8 +13,7 @@
%td
= number_to_currency p.price
%td
- = form_for p.orders.new, :url=>place_product_orders_path(p.place_id, p.id) do |f|
- = f.submit 'buy'
+ = link_to 'buy', new_place_product_order_path(p.place_id, p.id)
%h2 Add a drink
.pull-left
View
3 config/routes.rb
@@ -14,7 +14,8 @@
devise_scope :merchants do
resources :places do
resources :products do
- resources :orders
+ resources :orders do
+ end
end
end
end

0 comments on commit 2506132

Please sign in to comment.
Something went wrong with that request. Please try again.