Skip to content

Commit

Permalink
added shipping address
Browse files Browse the repository at this point in the history
  • Loading branch information
Elise Worthy committed Apr 19, 2012
1 parent f2a4947 commit 1c50b6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/order.rb
Expand Up @@ -51,14 +51,22 @@ def self.set_order_item_info
end

def self.set_order_info
self.set_order_details
self.set_order_credit_card_info
end

def self.set_order_details
@order.name = @user.orders.last.name
@order.email = @user.orders.last.email
@order.address = @user.orders.last.address
@order.shipping_address = @user.orders.last.shipping_address
end

def self.set_order_credit_card_info
@order.cc_number = @user.orders.last.cc_number
@order.cc_expiry = @user.orders.last.cc_expiry
end


def ship
update_attributes(:shipped_at => Time.now, :status => "shipped")
end
Expand Down
5 changes: 5 additions & 0 deletions app/views/orders/show.html.erb
Expand Up @@ -15,6 +15,11 @@
<%= @order.address %>
</p>

<p>
<b>Shipping Address</b><br>
<%= @order.shipping_address %>
</p>

<p>
<b>Email</b><br>
<%= @order.email %>
Expand Down

0 comments on commit 1c50b6f

Please sign in to comment.