1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/models/passport_confirmation.rb

19 lines
419 B
Ruby
Raw Normal View History

2018-11-30 03:13:54 -05:00
# frozen_string_literal: true
class PassportConfirmation < ApplicationRecord
belongs_to :passport
2018-12-01 21:28:34 -05:00
belongs_to :account
2018-11-30 03:13:54 -05:00
2018-12-01 21:28:34 -05:00
validates :account_id, uniqueness: { scope: :passport_id }
2018-12-01 06:05:50 -05:00
validate :passport_can_have_confirmations
2018-12-01 06:05:50 -05:00
private
def passport_can_have_confirmations
return if passport.nil? || passport.can_have_confirmations?
2018-12-02 11:44:02 -05:00
errors.add :passport, 'must have a passport map and an image'
2018-12-01 06:05:50 -05:00
end
2018-11-30 03:13:54 -05:00
end