Class: Hello::Management::ProfilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hello/management/profiles_controller.rb

Instance Method Summary collapse

Instance Method Details

#cancelObject

GET /hello/user/cancel



41
42
43
# File 'app/controllers/hello/management/profiles_controller.rb', line 41

def cancel
  render 'hello/management/cancel'
end

#destroyObject

DELETE /hello/user



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'app/controllers/hello/management/profiles_controller.rb', line 46

def destroy
  @cancel_account = Business::Management::CancelAccount.new(current_user)

  if @cancel_account.
    flash[:notice] = @cancel_account.success_message
    respond_to do |format|
      format.html { redirect_to '/' }
      format.json { render json: { cancelled: true }, status: :ok }
    end
  else
    flash.now[:alert] = @cancel_account.alert_message
    respond_to do |format|
      format.html { render 'hello/management/cancel' }
      format.json { render json: { message: @cancel_account.alert_message }, status: :unprocessable_entity }
    end
  end
end

#showObject

GET /hello/user



13
14
15
16
17
18
# File 'app/controllers/hello/management/profiles_controller.rb', line 13

def show
  respond_to do |format|
    format.html { render 'hello/management/user' }
    format.json { render json: @user.as_json_web_api, status: :ok }
  end
end

#updateObject

PATCH /hello/user



21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/hello/management/profiles_controller.rb', line 21

def update
  if @user_business.update(user_params)
    use_locale(current_user.locale)
    flash[:notice] = @user_business.success_message
    respond_to do |format|
      format.html { redirect_to hello.profile_path }
      format.json { render json: @user.as_json_web_api, status: :ok }
    end
  else
    render 'hello/management/user'
  end
end