Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VeNJOB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Hoang Mai Phuong
VeNJOB
Commits
823bc0ff
Commit
823bc0ff
authored
Aug 25, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor controller
parent
4a80d625
Pipeline
#1402
failed with stages
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
app/controllers/application_controller.rb
+8
-0
app/controllers/users/registrations_controller.rb
+9
-10
config/routes.rb
+3
-3
No files found.
app/controllers/application_controller.rb
View file @
823bc0ff
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
before_action
:configure_permitted_parameters
,
if: :devise_controller?
protected
def
configure_permitted_parameters
devise_parameter_sanitizer
.
permit
(
:sign_up
,
keys:
%i[name cv]
)
devise_parameter_sanitizer
.
permit
(
:account_update
,
keys:
%i[name cv]
)
end
end
end
app/controllers/users/registrations_controller.rb
View file @
823bc0ff
# frozen_string_literal: true
# frozen_string_literal: true
class
Users
::
RegistrationsController
<
Devise
::
RegistrationsController
class
Users
::
RegistrationsController
<
Devise
::
RegistrationsController
before_action
:configure_sign_up_params
,
only:
[
:create
]
# before_action :configure_sign_up_params, only: [:create]
before_action
:configure_account_update_params
,
only:
[
:update
]
# before_action :configure_account_update_params, only: [:update]
# before_action :configure_permitted_parameters, if: :devise_controller?
def
show
def
show
end
end
...
@@ -57,7 +56,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
...
@@ -57,7 +56,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
# end
# end
def
after_update_path_for
(
resource
)
def
after_update_path_for
(
resource
)
my_path
my_path
(
resource
)
end
end
# The path used after sign up for inactive accounts.
# The path used after sign up for inactive accounts.
...
@@ -66,11 +65,11 @@ class Users::RegistrationsController < Devise::RegistrationsController
...
@@ -66,11 +65,11 @@ class Users::RegistrationsController < Devise::RegistrationsController
end
end
# If you have extra params to permit, append them to the sanitizer.
# If you have extra params to permit, append them to the sanitizer.
def
configure_sign_up_params
#
def configure_sign_up_params
devise_parameter_sanitizer
.
permit
(
:sign_up
,
keys:
[
:name
,
:cv
])
#
devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :cv])
end
#
end
def
configure_account_update_params
#
def configure_account_update_params
devise_parameter_sanitizer
.
permit
(
:account_update
,
keys:
[
:name
,
:cv
])
#
devise_parameter_sanitizer.permit(:account_update, keys: [:name, :cv])
end
#
end
end
end
config/routes.rb
View file @
823bc0ff
...
@@ -9,7 +9,7 @@ Rails.application.routes.draw do
...
@@ -9,7 +9,7 @@ Rails.application.routes.draw do
post
'confirm'
,
to:
'apply_jobs#confirm'
post
'confirm'
,
to:
'apply_jobs#confirm'
post
'done'
,
to:
'apply_jobs#done'
post
'done'
,
to:
'apply_jobs#done'
devise_for
:users
,
controllers:
{
registrations:
'users/registrations'
,
confirmations:
'users/confirmations'
,
devise_for
:users
,
controllers:
{
registrations:
'users/registrations'
,
confirmations:
'users/confirmations'
,
passwords:
'users/passwords'
,
sessions:
'users/sessions'
},
skip:
[
:sessions
,
:registrations
,
:
passwords
]
passwords:
'users/passwords'
,
sessions:
'users/sessions'
},
skip:
%i[sessions registrations
passwords]
resources
:user
resources
:user
get
'/my'
,
to:
'users#show'
get
'/my'
,
to:
'users#show'
devise_scope
:user
do
devise_scope
:user
do
...
@@ -17,10 +17,10 @@ Rails.application.routes.draw do
...
@@ -17,10 +17,10 @@ Rails.application.routes.draw do
get
'register/2'
,
to:
'users/registrations#show'
get
'register/2'
,
to:
'users/registrations#show'
get
'my/info'
,
to:
'users/registrations#edit'
,
as: :edit_user_registration
get
'my/info'
,
to:
'users/registrations#edit'
,
as: :edit_user_registration
match
'/my'
,
to:
'devise/registrations#create'
,
as: :user_registration
,
via:
[
:post
]
match
'/my'
,
to:
'devise/registrations#create'
,
as: :user_registration
,
via:
[
:post
]
match
'/my'
,
to:
'devise/registrations#update'
,
via:
[
:put
,
:
patch
]
match
'/my'
,
to:
'devise/registrations#update'
,
via:
%i[put
patch]
get
'forgot_password'
,
to:
'users/passwords#new'
,
as: :new_user_password
get
'forgot_password'
,
to:
'users/passwords#new'
,
as: :new_user_password
get
'reset_password'
,
to:
'users/passwords#edit'
,
as: :edit_user_password
get
'reset_password'
,
to:
'users/passwords#edit'
,
as: :edit_user_password
match
'reset_password'
,
to:
'users/passwords#update'
,
via:
[
:put
,
:
patch
]
match
'reset_password'
,
to:
'users/passwords#update'
,
via:
%i[put
patch]
match
'reset_password'
,
to:
'users/passwords#create'
,
as: :user_password
,
via:
[
:post
]
match
'reset_password'
,
to:
'users/passwords#create'
,
as: :user_password
,
via:
[
:post
]
get
'login'
,
to:
'users/sessions#new'
,
as: :new_user_session
get
'login'
,
to:
'users/sessions#new'
,
as: :new_user_session
post
'login'
,
to:
'users/sessions#create'
,
as: :user_session
post
'login'
,
to:
'users/sessions#create'
,
as: :user_session
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment