What is the best practice to create has_one (always exist) model
relationships when creating the parent model.
class User < ActiveRecord::Base
class Balance < ActiveRecord::Base
A User always has a Balance
I would like to create the Balance model when the User is saved.
There is 3 (maybe more choices to accomplish this), which one is the
Create the Balance model and associate it to the User from the
controller that is creating the User model.
Do it in the User model with after_create :create_balance
Do it in a UserObeserver:
class UserObserver < ActiveRecord::Observer
balance = Balance.new(:amount => 0)
balance = customer
Thanks! If this has been covered before, sorry, but just not finding
the right search terms to limit results.