Class: Spree::Invitation
- Inherits:
-
Object
- Object
- Spree::Invitation
- Defined in:
- app/models/spree/invitation.rb
Instance Method Summary collapse
-
#expired? ⇒ Boolean
returns true if the invitation has expired.
-
#resend! ⇒ Object
Resends the invitation email if the invitation is pending and not expired.
-
#store ⇒ Spree::Store
returns the store for the invitation if the resource is a store, return the resource if the resource responds to store, return the store otherwise, return the current store.
Instance Method Details
#expired? ⇒ Boolean
returns true if the invitation has expired
75 76 77 |
# File 'app/models/spree/invitation.rb', line 75 def expired? expires_at < Time.current end |
#resend! ⇒ Object
Resends the invitation email if the invitation is pending and not expired
80 81 82 83 84 |
# File 'app/models/spree/invitation.rb', line 80 def resend! return if expired? || deleted? || accepted? send_invitation_email end |
#store ⇒ Spree::Store
returns the store for the invitation if the resource is a store, return the resource if the resource responds to store, return the store otherwise, return the current store
63 64 65 66 67 68 69 70 71 |
# File 'app/models/spree/invitation.rb', line 63 def store if resource.is_a?(Spree::Store) resource elsif resource.respond_to?(:store) resource.store else Spree::Store.current end end |