[RUBY] [Rails] Added in devise: username not added to database

problem

--The sign_up screen does not save even if you enter the user name --I can't save to DB for some reason with rollback transaction

Premise

--Introducing devise and adding a new column
(this time: username column) --The error message is translated into Japanese

What i did

--I don't understand the English error, so Japaneseize devise and
[Correct "translation missing" after Devise Japaneseization] See (https://poinorou.hatenablog.com/entry/2019/09/16/090336)

Solution

to application_controller

application_controller


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

  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
  end
end

Fill in: ok_hand:

Recommended Posts

[Rails] Added in devise: username not added to database
What to do when rails db: seed does not reflect in the database
Introduce devise in Rails to implement user management functionality
Do not write 〇〇 logic in Rails View (* added later)
[Rails] Add column to devise
[rails devise] How to transition users who are not logged in to the login page
[Rails] How to display information stored in the database in view
[Rails] How to use gem "devise"
[Rails] How to use devise (Note)
[Rails] Session timeout setting in devise
[rails] Login screen implementation in devise
[Rails] Unexpected validation error in devise
[Rails] Add strong parameters to devise
How to introduce jQuery in Rails 6
Data is not registered in Rails.
How to install Swiper in Rails
[Rails] What to do if data is not registered in DB
I want to add devise in Rails, but I can't bundle install
[Rails] How to reset the database in production environment (Capistrano version)
[Rails] Function restrictions in devise (login / logout)
How to change app name in rails
How to use custom helpers in rails
[Rails] How to log in with a name by adding a devise name column
How to insert a video in Rails
JavaScript (vanilla) does not respond in Rails.
How to use MySQL in Rails tutorial
How to update user edits in Rails Devise without entering a password
Steps to set a favicon in Rails
[Rails] [Memo] When to add = to <%%> and when not
[Rails] How to get the user information currently logged in with devise
[rails] How to configure routing in resources
[Rails] Use devise to get information about the currently logged in user
[Rails] devise
How to implement ranking functionality in Rails
[Note] How to use Rails 6 Devise + cancancan
[Rails] The cause of not being able to post was in form_with
[Rails] Reset the database in the production environment
How to use credentials.yml.enc introduced in Rails 5.2
[Rails] How to translate devise into Japanese
[For rails beginners] Specify transition destination after logging in to multiple Devise models
[Rails] Give this article to you who looked up in "devise name login"
Create authentication function in Rails application using devise
Convert to a tag to URL string in Rails
The road to Japaneseizing Rails devise error messages
[Rails] Various ways to write in seed files
[Rails] rails new to create a database with PostgreSQL
I tried to organize the session in Rails
[Rails] How to use select boxes in Ransack
How to translate Rails into Japanese in general
How to prevent direct URL typing in Rails
[Rails] Bootstrap form-control does not apply to date_select
How to separate .scss by controller in Rails
How to implement a like feature in Rails
How to use JQuery in js.erb of Rails6
[Ruby on Rails] How to install Bootstrap in Rails
How to make a follow function in Rails
[Rails] How to use PostgreSQL in Vagrant environment
How to check Rails commands in the terminal
Remedy for command not found in rails s
Rails database basics
For those who want to use MySQL for the database in the environment construction of Rails6 ~.