I'm using devise to do the new user registration. Right after a new user is created, I would also like to create a profile for that user.
My create
method in the registrations_controller.rb
is as follows:
class RegistrationsController < Devise::RegistrationsController
def create
super
session[:omniauth] = nil unless @user.new_record?
# Every new user creates a default Profile automatically
@profile = Profile.create
@user.default_card = @profile.id
@user.save
end
But, it is not creating a new Profile and neither is the field for @user.default_card is being filled in. How can I create a new Profile automatically upon each new user registration with devise?