Ruby on Rails authentication with Devise
Topics: Ruby on Rails, Authentication
The code uses an after_create callback to create a profile record for each newly created User in a Rails application.
Creating users with an associated model
class User < ActiveRecord::Base
has_one :profile, dependent: :destroy
after_create :init_profile
def init_profile
self.create_profile!
end
end