Class: InvitationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/invitations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/invitations_controller.rb', line 13

def create
  @invitation = Invitation.new(params[:invitation])
  @invitation. = 
  @invitation.sender  = current_user
  if @invitation.save
    flash[:success] = "User invited."
    redirect_to ()
  else
    assign_projects
    render :action => 'new'
  end
end

#newObject



7
8
9
10
11
# File 'app/controllers/invitations_controller.rb', line 7

def new
  assign_projects
  @invitation = Invitation.new
  render
end

#showObject



26
27
28
# File 'app/controllers/invitations_controller.rb', line 26

def show
  with_invitation { render }
end

#updateObject



30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/invitations_controller.rb', line 30

def update
  with_invitation do
    if @invitation.accept(params[:invitation])
       @invitation.user
      redirect_to root_url
    else
      render :action => 'show'
    end
  end
end