Permalink
Browse files

Fixed bug: calling nil object

  • Loading branch information...
1 parent be978b8 commit ba2f00e470038a15133bc3862de850703a712dcf Sutee Sudprasert committed Jul 3, 2011
Showing with 3 additions and 2 deletions.
  1. +2 −2 app/controllers/checkout_controller_decorator.rb
  2. +1 −0 app/views/checkout/_address.html.erb
@@ -28,8 +28,8 @@ def normalize_addresses
@order.bill_address.destroy
@order.update_attribute(:bill_address_id, @order.ship_address.id)
else
- @order.bill_address.update_attribute(:user_id, current_user.try(:id))
+ @order.bill_address.update_attribute(:user_id, current_user.try(:id)) unless @order.bill_address.nil?
end
- @order.ship_address.update_attribute(:user_id, current_user.try(:id))
+ @order.ship_address.update_attribute(:user_id, current_user.try(:id)) unless @order.ship_address.nil?
end
end
@@ -11,6 +11,7 @@
<% ['billing', 'shipping'].each do |address_type|
next if address_type == 'billing' && Spree::Config[:disable_bill_address]
address_name = "#{address_type[0...4]}_address" %>
+
<fieldset id="<%= address_type %>">
<legend><%= t(address_type + "_address")%></legend>
<% if address_type == 'shipping' && !Spree::Config[:disable_bill_address] %>

0 comments on commit ba2f00e

Please sign in to comment.