Skip to content

Commit

Permalink
Fix "undefined method new_record?" for user addresses
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rainerdema committed Nov 15, 2023
1 parent 4e053bf commit c0b9942
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion admin/app/controllers/solidus_admin/addresses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def update

def find_address
if params[:address_id].present? && @order.user
@order.user.addresses.find(params[:address_id])
address = @order.user.addresses.find_by(id: params[:address_id])
@order.send("#{address_type}_address=", address) if address
else
@order.send("#{address_type}_address")
end
Expand Down

0 comments on commit c0b9942

Please sign in to comment.