Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mrgilman/store_engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Austen Ito committed Apr 19, 2012
2 parents 6e07876 + 30f3f39 commit 41f0330
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
22 changes: 14 additions & 8 deletions app/controllers/billing_addresses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ def create
if @billing_address.save
current_user.billing_address = @billing_address
current_user.save
if params[:same_as_shipping_address] == "1"
current_user.shipping_address =
ShippingAddress.new(params[:billing_address])
current_user.save
redirect_to new_transaction_path
else
redirect_to new_shipping_address_path
end
same_shipping_address(params)
else
render :action => "new"
end
Expand All @@ -29,4 +22,17 @@ def update
@billing_address.update_attributes(params[:billing_address])
redirect_to order_summary_path
end

private

def same_shipping_address(params_hash)
if params_hash[:same_as_shipping_address] == "1"
current_user.shipping_address =
ShippingAddress.new(params[:billing_address])
current_user.save
redirect_to new_transaction_path
else
redirect_to new_shipping_address_path
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/categories_products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ class CategoriesProductsController < ApplicationController
def index
@category = Category.find(params[:category_id])
products = Category.find(params[:category_id]).products.find(:all,
:conditions => { :retired => false})
:conditions => { :retired => false})
rows = products.length / 5
@product_rows = []
rows.times do |i|
rows.times do |row|
@product_rows << products.pop(5)
end

Expand Down
1 change: 0 additions & 1 deletion app/controllers/shipping_addresses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ def new
def create
@shipping_address = ShippingAddress.new(params[:shipping_address])
if @shipping_address.save
session[:shipping_address] = @shipping_address.id
current_user.shipping_address = @shipping_address
current_user.save
redirect_to new_transaction_path
Expand Down

0 comments on commit 41f0330

Please sign in to comment.