Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Users model
- Users belongs_to :account
- and account has_many :users
- if self.account_id.nil?
- #This Works
- newaccount=Account.create(:name=>self.name)
- self.account_id=newaccount.id
- self.save
- # This fails with a reference to a nil object
- #raise self.inspect
- #self.account.create(:name=>self.name)
- end
- I checked self and name is set
- so why the crash
Add Comment
Please, Sign In to add comment