Module: Revise::Inviter

Extended by:
ActiveSupport::Concern
Defined in:
lib/revise/inviter.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#has_invitations_left?Boolean

Return true if this user has invitations left to send

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/revise/inviter.rb', line 15

def has_invitations_left?
  if self.class.invitation_limit.present? || self.respond_to?(:invitation_limit)
    if invitation_limit
      return invitation_limit > 0
    else
      return self.class.invitation_limit > 0 if self.class.invitation_limit.present?
      return false
    end
  else
    return true
  end
end

#invitation_limitObject



10
11
12
# File 'lib/revise/inviter.rb', line 10

def invitation_limit
  self[:invitation_limit] || self.class.invitation_limit
end