Skip to content

Commit

Permalink
fixed how ordering works
Browse files Browse the repository at this point in the history
  • Loading branch information
SpinnakerSix committed Jun 17, 2012
1 parent 7c74cc2 commit 2506132
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/custom.css.scss
@@ -0,0 +1,3 @@
textarea{
height:10em;
}
1 change: 1 addition & 0 deletions app/controllers/orders_controller.rb
@@ -1,5 +1,6 @@
class OrdersController < ApplicationController
def new
@place = Place.find(params[:place_id])
end

def show
Expand Down
9 changes: 8 additions & 1 deletion 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'

6 changes: 2 additions & 4 deletions 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|
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion config/routes.rb
Expand Up @@ -14,7 +14,8 @@
devise_scope :merchants do
resources :places do
resources :products do
resources :orders
resources :orders do
end
end
end
end
Expand Down

0 comments on commit 2506132

Please sign in to comment.