Class: VoucherUser
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- VoucherUser
- Defined in:
- app/models/voucher_user.rb
Instance Method Summary collapse
- #already_required(voucher) ⇒ Object
- #confirm ⇒ Object
- #has_confirmed(voucher) ⇒ Object
- #send_confirmation_email ⇒ Object
Instance Method Details
#already_required(voucher) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/models/voucher_user.rb', line 20 def already_required(voucher) user = VoucherUser.where({voucher_id: voucher[:id], id: @attributes['id']}).first if user true else false end end |
#confirm ⇒ Object
13 14 15 16 17 |
# File 'app/models/voucher_user.rb', line 13 def confirm @confirmed = true @confirmation_date = Time.now @save end |
#has_confirmed(voucher) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/models/voucher_user.rb', line 29 def has_confirmed(voucher) user = VoucherUser.where({voucher_id: voucher[:id], id: @attributes['id'], confirmed: true}).first if user true else false end end |
#send_confirmation_email ⇒ Object
38 39 40 |
# File 'app/models/voucher_user.rb', line 38 def send_confirmation_email VoucherMailer.send_confirmation_link(self).deliver end |