Class: UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/install/templates/app/controllers/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @user = User.new(user_params)

  if @user.save
    (@user)
    redirect_to :root
  else
    render :new, status: :unprocessable_entity
  end
end

#editObject



22
# File 'lib/install/templates/app/controllers/users_controller.rb', line 22

def edit; end

#newObject



7
8
9
# File 'lib/install/templates/app/controllers/users_controller.rb', line 7

def new
  @user = User.new
end

#updateObject



24
25
26
27
28
29
30
# File 'lib/install/templates/app/controllers/users_controller.rb', line 24

def update
  if Current.user.update(user_params)
    redirect_to [:edit, Current.user], notice: 'Successfully updated your profile.'
  else
    render :edit, status: :unprocessable_entity
  end
end