LoginSignup
7
7

More than 5 years have passed since last update.

deviseのユーザー登録に項目を追加する。

Posted at

やりたいこと

deviseのユーザー登録時に独自の入力項目を追加する.

環境

  • ruby 2.1.3
  • rails 4.1.6
  • devise 3.4.1

手順

  1. usersテーブルに独自に追加する項目のカラムを追加する。

  2. deviseのregistrations_controllerにパラムを追加する

registrations_controller.rb
def sign_up_params
     devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email ...) }
     super
end

3. ユーザー登録フォームに項目を追加

7
7
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
7
7