Class: Work::UsersController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @user = User.create(params.require(:user).permit(:name, :email, :password))

  if @user.errors.any?
    render :new
  else
    redirect_to work_users_path
  end
end

#indexObject



4
5
6
# File 'app/controllers/work/users_controller.rb', line 4

def index
  @users = User.all
end

#newObject



8
9
10
# File 'app/controllers/work/users_controller.rb', line 8

def new
  @user = User.new
end

#reset_password_emailObject



22
23
24
25
26
27
# File 'app/controllers/work/users_controller.rb', line 22

def reset_password_email
  user = User.find(params[:id])
  user.send_reset_password_instructions
  flash[:notice] = "Reset password instructions have been sent to #{user.email}."
  redirect_to work_users_path
end