You can create default profile by using ActiveRecord callbacks.
Just create a method, and use it as :after_create
class User < ActiveRecord::Base
has_one :profile
after_create :create_default_profile
def create_default_profile
profile = build_profile
# set parameters
profile.save
end
end
build_profile builds and links an instace of Profile, but doesn't save it. create_profile is the same, but it also saves the object. For the full description, see the ActiveRecord documentation.
You can add attributes to both build_ and create_profile as a hash, so you probably can reduce create_default_profile to one line:
def create_default_profile
profile = create_profile :some => 'attirbute', :to => 'set'
end