app/contoller/customers/registrations_controller.rb
class Customers::RegistrationsController < Devise::RegistrationsController
before_action :configure_sign_up_params, only: [:create]
...
def create
super
@customer.company_id = params[:company_id]
binding.pry
if @customer.save
CustomerStatus.create(paid: false, room_plus: false, dozen_sessions: false, numbers_of_contractnt: 0, customer_id: @customer.id)
end
end
...
protected
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:company_id])
end
deviseはbelongs_to をしたら新規登録でうまくいかなくなるみたいなので、気をつけましょうというメモです。
以上!