Class: CargoWiki::UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cargo_wiki/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
# File 'app/controllers/cargo_wiki/users_controller.rb', line 13

def create
  @user = User.new(params[:user])
  if @user.save
    redirect_to users_path, :notice => "Account created!"
  else
    render "new"
  end
end

#destroyObject



39
40
41
42
43
# File 'app/controllers/cargo_wiki/users_controller.rb', line 39

def destroy
  @user = User.find(params[:id])
  @user.destroy
  redirect_to users_path, :notice => "successfully destroyed!"
end

#editObject



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

def edit
  @user = User.find(params[:id])
end

#indexObject



5
6
7
# File 'app/controllers/cargo_wiki/users_controller.rb', line 5

def index
  @users = User.all
end

#newObject



9
10
11
# File 'app/controllers/cargo_wiki/users_controller.rb', line 9

def new
  @user = User.new
end

#showObject



22
23
24
# File 'app/controllers/cargo_wiki/users_controller.rb', line 22

def show
  @user = User.find(params[:id])
end

#updateObject



30
31
32
33
34
35
36
37
# File 'app/controllers/cargo_wiki/users_controller.rb', line 30

def update
  @user = User.find(params[:id])
  if @user.update_attributes(params[:user])
    redirect_to users_path, :notice => "Updated successfully!"
  else
    render "edit"
  end
end