1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails5でdeviseに新しいカラムを追加した時のcontrollerの書き方

Last updated at Posted at 2018-06-19

ApplicationControllerに下記を追加するだけでした。

  before_action :configure_permitted_parameters, if: :devise_controller?

  private
    def configure_permitted_parameters
      devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :avator])
      devise_parameter_sanitizer.permit(:account_update, keys: [:name, :avator])
    end

Deviseの新しいcontrollerを作ってコードを書く手もあるけど、こっちは未確認。

rails g devise:controllers users
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?