Module: MuckInvites::Models::MuckInvitee::ClassMethods

Defined in:
lib/muck-invites/models/invitee.rb

Instance Method Summary collapse

Instance Method Details

#who_invited?(email, invitee_id = nil) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/muck-invites/models/invitee.rb', line 25

def who_invited?(email, invitee_id = nil)
  users = []

  if !invitee_id.nil?
    invite = self.find(invitee_id)
    users |= invite.users if !invite.nil?
  end

  invite = self.find_by_email(email)
  users |= invite.users if !invite.nil?

  users
end