Class: Panda::Core::Admin::MyProfileController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/panda/core/admin/my_profile_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#add_breadcrumb, #authenticate_admin_user!, #authenticate_user!, #breadcrumbs, #current_user, #set_current_request_details, #user_signed_in?

Instance Method Details

#editObject

Shows the edit form for the current user’s profile

Returns:

  • void



12
13
14
# File 'app/controllers/panda/core/admin/my_profile_controller.rb', line 12

def edit
  render :edit, locals: {user: current_user}
end

#updateObject

Updates the current user’s profile

Returns:

  • void



19
20
21
22
23
24
25
26
# File 'app/controllers/panda/core/admin/my_profile_controller.rb', line 19

def update
  if current_user.update(user_params)
    flash[:success] = "Your profile has been updated successfully."
    redirect_to edit_admin_my_profile_path
  else
    render :edit, locals: {user: current_user}, status: :unprocessable_content
  end
end