Skip to content

Commit

Permalink
checkout action を実装
Browse files Browse the repository at this point in the history
  • Loading branch information
kyanny committed Jan 22, 2010
1 parent 93debaa commit 3330b84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions depot/app/controllers/store_controller.rb
Expand Up @@ -31,6 +31,15 @@ def empty_cart
end
end

def checkout
@cart = find_cart
if @cart.items.empty?
redirect_to_index("カートは現在空です")
else
@order = Order.new
end
end

private

def find_cart
Expand Down
1 change: 1 addition & 0 deletions depot/app/views/store/_cart.html.erb
Expand Up @@ -9,6 +9,7 @@

</table>

<%= button_to "チェックアウト", :action => "checkout" %>
<% form_remote_tag :url => { :action => :empty_cart } do %>
<%= submit_tag "カートを空にする" %>
<% end %>

0 comments on commit 3330b84

Please sign in to comment.