summaryrefslogtreecommitdiff
path: root/app/models/payment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/payment.rb')
-rw-r--r--app/models/payment.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/payment.rb b/app/models/payment.rb
index 4839de8..8be9c7f 100644
--- a/app/models/payment.rb
+++ b/app/models/payment.rb
@@ -8,7 +8,7 @@ class Payment < ApplicationRecord
validate :card_belongs_to_user
def card_belongs_to_user
- return unless order.user_account.cards.find_by(id: card.id).nil?
+ return if Order.find_by(id: order_id)&.user_account&.cards&.exists?(card_id)
errors.add(:card_id, "doesn't belong to user")
end