[Rails] Processing after adding a column to the devise table

Description in apprication.controller.rb

Since the controller of devise cannot be tampered with, operate by writing the following in ʻapprication.controller.rb`.

apprication.controller.rb


params.require(:Model name).permit(:Keys to allow) #Normal strong parameters

devise_parameter_sanitizer.permit(:devise process name, keys: [:Allowed column name]) # devise_parameter_strong parameters of sanitizer

devise process name

: sign_in (when performing sign-in processing) : sign_up (when performing sign-up processing) : account_update (when processing account information update)

Settings for apprication.controller.rb

if before_action is a devise helper method that executes processing only when the return value is true. For controller processing related to devise, execute the configure_permitted_parameters method.

apprication.controller.rb


class ApplicationController < ActionController::Base
  before_action :configure_permitted_parameters, if: :devise_controller?

  private
  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(:Process name, keys: [:Column name])
  end
end

Recommended Posts

[Rails] Processing after adding a column to the devise table
[Rails] I learned about migration files! (Adding a column to the table)
[Rails] How to log in with a name by adding a devise name column
[Rails] How to create a table, add a column, and change the column type
[Rails] Add column to devise
[Rails] How to change the column name of the table
The road to Japaneseizing Rails devise error messages
[Ruby] When adding a null constraint to a table
[Rails / Docker] What to do if access is denied by the browser (localhost: 3000) after adding a gem
How to make a unique combination of data in the rails intermediate table
From the introduction of devise to the creation of the users table
[Rails] After introducing (intentionally) devise, the command stopped working
[Ruby on Rails] How to change the column name
[Rails] How to install devise
I want to create a form to select the [Rails] category
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
A validation error occurred when saving to the intermediate table.
How to create a registration / update function where the table crosses
[Java] Adding an element to the Collection causes a compile error
[Rails] Add a confirmation screen and a completion screen to devise membership registration.
[Rails] How to put a crown mark on the ranking function
[Self-study] Creating a portfolio (original app) after completing the Rails tutorial
(Ruby on Rails6) Create a function to edit the posted content
[Rails 5] How to display the password change screen when using devise
[Rails] How to use gem "devise"
How to add columns to a table
[Rails] How to use devise (Note)
Preparing to create a Rails application
[Rails] Add strong parameters to devise
When you want to add a string type column with a limited length with the `rails generate migration` command
What to do if the image posted by refile disappears after setting a 404 error page in Rails
How to update user edits in Rails Devise without entering a password
[Rails] How to get the user information currently logged in with devise
[Rails] Use devise to get information about the currently logged in user
How to debug the processing in the Ruby on Rails model only on the console
Send a request to the backend after authenticating with Spring Cloud Gateway
How to reference a column when overriding the column name method in ActiveRecord
[Rails] How to solve the time lag of created_at after save method
[Rails] devise customization. How to change the redirect page after user registration and editing, and how to skip password input when editing
Migration file to add comment to Rails table
The road to creating a music game 2
How to insert a video in Rails
[Rails] How to use the map method
[Processing × Java] How to use the loop
Steps to set a favicon in Rails
[Processing × Java] How to use the class
Check the processing contents with [rails] binding.pry
[rails] How to create a partial template
[Note] How to use Rails 6 Devise + cancancan
[Processing × Java] How to use the function
The process of introducing Vuetify to Rails
The road to creating a music game 3
[Rails] How to translate devise into Japanese
The road to creating a music game 1
If it is Ruby, it is efficient to make it a method and stock the processing.
[Rails6] How to connect the posting function generated by Scaffold with the user function generated by devise
[For rails beginners] Specify transition destination after logging in to multiple Devise models
[Rails] How to register multiple records in the intermediate table with many-to-many association
[Rails] When transitioning to a page with link_to, move to the specified location on the page