Slide 66
Slide 66 text
1 def accept_invitation!(opts = {})
2 if self.invited?
3 self.setup(opts)
4 self.invitation_token = nil
5 self.password = opts[:password]
6 self.password_confirmation = opts[:password_confirmation]
7
8 self.save
9 return unless self.errors.empty?
10
11 # moved old Invitation#share_with! logic into here,
12 # but i don't think we want to destroy the invitation
13 # anymore. we may want to just call self.share_with
14 invitations_to_me.each do |invitation|
15 if !invitation.admin? &&
invitation.sender.share_with(self.person,
invitation.aspect)
16 invitation.destroy
17 end
18 end
19
20 self
21 end
22 end