Class: ReviseAuth::RegistrationsController

Inherits:
ReviseAuthController show all
Defined in:
app/controllers/revise_auth/registrations_controller.rb

Instance Method Summary collapse

Methods inherited from ReviseAuthController

#revise_auth_controller?

Methods included from Authentication

#authenticate_user, #authenticate_user!, #authenticated_user_from_session, #current_user, #login, #logout, #reset_session, #user_signed_in?

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/revise_auth/registrations_controller.rb', line 8

def create
  @user = User.new()
  if @user.save
    (@user)
    current_user.api_tokens.first_or_create(name: ApiToken::APP_NAME)
    redirect_to root_path
  else
    render :new, status: :unprocessable_entity
  end
end

#deleteObject



30
31
32
33
34
# File 'app/controllers/revise_auth/registrations_controller.rb', line 30

def delete
  current_user.destroy
  logout
  redirect_to root_path, status: :see_other, alert: I18n.t("revise_auth.account_deleted")
end

#editObject



19
20
# File 'app/controllers/revise_auth/registrations_controller.rb', line 19

def edit
end

#newObject



4
5
6
# File 'app/controllers/revise_auth/registrations_controller.rb', line 4

def new
  @user = User.new
end

#updateObject



22
23
24
25
26
27
28
# File 'app/controllers/revise_auth/registrations_controller.rb', line 22

def update
  if current_user.update(profile_params)
    redirect_to profile_path, notice: I18n.t("revise_auth.account_updated")
  else
    render :edit, status: :unprocessable_entity
  end
end