Skip to content

Commit d1ce68e

Browse files
committed
Fix issue with destroying user record
Fixes #184 Fix issue where when calling `really_destroy!` on a user record will attempt to save changes to a deleted record due to `scramble_email_and_password` callback. This caused a runtime error "Can't modify frozen hash". To fix this issue, return from the method immediate if the record has been destroyed.
1 parent 230681c commit d1ce68e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

app/models/spree/user.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def set_login
4646
end
4747

4848
def scramble_email_and_password
49+
return true if destroyed?
50+
4951
self.email = SecureRandom.uuid + "@example.net"
5052
self.login = email
5153
self.password = SecureRandom.hex(8)

0 commit comments

Comments
 (0)