Ruby
Rails

deviseでユーザーにカラムを追加する

bundle ecec rails g migrationでmigration fileを追加


db/yyyymmddhhmmss_create_users.rb

#略

create_table :user do |t|
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.string :name
t.string :birthday
t.string :adress
# 以下略....


users/registrations_controller.rb

before_action :configure_sign_up_params,only: [:create]

def configure_sign_up_params
devise_parameter_savitizer.permit(
:sign_up,keys: [
:name,
:birthday,
:adress
]
)
end
end