Class InvitationsController
In: app/controllers/invitations_controller.rb
Parent: ApplicationController

Methods

create   edit   new   update  

Public Instance methods

[Source]

    # File app/controllers/invitations_controller.rb, line 32
32:   def create
33:     @invitation = Invitation.new({:peer_group => @peer_group,
34:         :creator_user => current_user}.merge(params[:invitation]))
35:     if @invitation.save
36:       @invitation.deliver_invitation!
37:       if @invitation.user.nil?
38:         flash[:notice] = t 'c.invitations.sent_to',
39:             :user => @invitation.email
40:       else
41:         flash[:notice] = t 'c.invitations.sent_to',
42:             :user => @invitation.user.name
43:       end
44:       redirect_to_return_url_or_default # same form again for another invite
45:     else
46:       @invitation = Invitation.new
47:       flash[:error] = t 'c.invitations.error_creating'
48:       render :action => :new
49:     end
50:   end

[Source]

    # File app/controllers/invitations_controller.rb, line 52
52:   def edit
53:     @user = User.new
54:     @user_session = UserSession.new
55:     session[:invitation] = params[:id]
56:   end

Crud-methods

[Source]

    # File app/controllers/invitations_controller.rb, line 28
28:   def new
29:     @invitation = Invitation.new
30:   end

[Source]

    # File app/controllers/invitations_controller.rb, line 58
58:   def update
59:     if @invitation.admit(current_user)
60:       if @invitation.role == Const::PeerGroupMembership::ADMIN
61:         flash[:notice] = t 'c.invitations.made_co_founder'
62:       else
63:         flash[:notice] = t 'c.invitations.joined'
64:       end
65:       @invitation.destroy
66:       redirect_to peer_group_ll_url(@invitation.peer_group)
67:     else
68:       flash[:error] = t 'c.invitations.error_joining'
69:       render :action => :edit
70:     end
71:   end

[Validate]