refactor controller

parent 4a80d625
Pipeline #1402 failed with stages
in 0 seconds
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
# frozen_string_literal: true
class Users::RegistrationsController < Devise::RegistrationsController
before_action :configure_sign_up_params, only: [:create]
before_action :configure_account_update_params, only: [:update]
# before_action :configure_permitted_parameters, if: :devise_controller?
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]
def show
end
......@@ -57,7 +56,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
# end
def after_update_path_for(resource)
my_path
my_path(resource)
end
# The path used after sign up for inactive accounts.
......@@ -65,12 +64,12 @@ class Users::RegistrationsController < Devise::RegistrationsController
register_2_path
end
# If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :cv])
end
# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_up_params
# devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :cv])
# end
def configure_account_update_params
devise_parameter_sanitizer.permit(:account_update, keys: [:name, :cv])
end
# def configure_account_update_params
# devise_parameter_sanitizer.permit(:account_update, keys: [:name, :cv])
# end
end
......@@ -9,7 +9,7 @@ Rails.application.routes.draw do
post 'confirm', to: 'apply_jobs#confirm'
post 'done', to: 'apply_jobs#done'
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
get '/my', to: 'users#show'
devise_scope :user do
......@@ -17,10 +17,10 @@ Rails.application.routes.draw do
get 'register/2', to: 'users/registrations#show'
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#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 '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]
get 'login', to: 'users/sessions#new', as: :new_user_session
post 'login', to: 'users/sessions#create', as: :user_session
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment