[RUBY] [rails] Problems that cannot be registered / logged in with devise

I can't register / log in with devise

After creating a user registration and login screen with devise This method is for when you want to register / log in with information other than the default (email).

I edited the form on the view page, but there is a trap that I cannot register or log in to. please refer.

In the following cases, the keys of sing_up and account_update are changed.


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

    def configure_permitted_parameters
		if resource_class == User
   			devise_parameter_sanitizer.permit(:sign_up, keys: [:name,:email])

defore _action

before_action :configure_permitted_parameters, if: :devise_controller?

before_action is a kind of filter, which is executed for all controllers by writing it in application.contoller.

: devise_contoller? is one of the helper methods that can be created when devise is generated. If you want to jump to the screen related to devise. This will launch configure_permitted_parameters on all devise screens.

This means that if it's a devise controller (if the return value of the devise_controller? Method is true), call configure_permitted_parameters.

Recommended Posts

[rails] Problems that cannot be registered / logged in with devise
Rails g devise: install cannot be executed!
Rails server cannot be started in Cloud9
[Rails] How to get the user information currently logged in with devise
[Rails 6] method :: delete cannot be used with link_to
Check with Java / Kotlin that files cannot be written in UAC on Windows
Handle devise with Rails
Japaneseize using i18n with Rails
Memo that transitions to the login screen if you are not logged in with devise
React.js CSS in Rails app deployed on EC2 cannot be loaded
Note that system properties including JAXBContext cannot be used in Java11
SwiftUI View that can be used in combination with other frameworks
[Rails] Session timeout setting in devise
[rails] Login screen implementation in devise
[Rails] Unexpected validation error in devise
Data is not registered in Rails.
[Rails 6] MySQL 2 cannot be bundle install
Create My Page with Rails devise
A story that addresses the problem that REMOTE_ADDR cannot be acquired in a cluster built with Docker Swarm + Traefik (1.7).
[Rails] How to log in with a name by adding a devise name column
About the problem that the server can not be started with rails s
Settings that should be done when operating a production environment with Rails
[Rails] "pry-rails" that can be used when saving with the create method
[Rails 6] Register and log in with Devise + SNS authentication (multiple links allowed)
[Rails] Use devise to get information about the currently logged in user
Phenomenon that cannot log out even though it is described in devise
Ruby array methods that can be used with Rails (other than each)
[Rails] Function restrictions in devise (login / logout)
[Rails] Rails new cannot be done from Docker
Object registered in session must be Serializable
[Rails] Posts cannot be deleted when commented! ??
Problems and workarounds that create an unusually large runtime with jlink in openjdk
[Swift5] Problem that Cell cannot be tapped when TextView is placed in TableViewCell