Class: Ltm::UsersController

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

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/ltm/users_controller.rb', line 9

def create
  @user = User.create(user_params)
  if @user.save
    redirect_to users_path, notice: "User created"
  else
    render :new
  end
end

#editObject



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

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

#indexObject



3
4
5
# File 'app/controllers/ltm/users_controller.rb', line 3

def index
  @users = Ltm::User.all
end

#newObject



6
7
8
# File 'app/controllers/ltm/users_controller.rb', line 6

def new
  @user = User.new
end

#showObject



18
19
20
21
# File 'app/controllers/ltm/users_controller.rb', line 18

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

#updateObject



25
26
27
28
29
30
31
32
# File 'app/controllers/ltm/users_controller.rb', line 25

def update
  @user = User.find(params[:id])
  if @user.save
    redirect_to users_path, notice: "User updated"
  else
    render :edit, status: :unprocessable_entity
  end
end