Skip to content

Commit c0b9942

Browse files
committed
Fix "undefined method new_record?" for user addresses
Fixed an issue where `new_record?` was called on a non-existent address associated with an order object, leading to an "undefined method" error. The problem was identified as the loss of a newly built address after a page refresh, caused by the address selection process retrieving the address without assigning it to the order.
1 parent 4e053bf commit c0b9942

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

admin/app/controllers/solidus_admin/addresses_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def update
5050

5151
def find_address
5252
if params[:address_id].present? && @order.user
53-
@order.user.addresses.find(params[:address_id])
53+
address = @order.user.addresses.find_by(id: params[:address_id])
54+
@order.send("#{address_type}_address=", address) if address
5455
else
5556
@order.send("#{address_type}_address")
5657
end

0 commit comments

Comments
 (0)