[Nitro] The has_one/belongs_to relationship

Jonathan Buch john at oxyliquit.de
Sat Aug 18 04:47:45 EDT 2007


> When I try to assign the created character to Account#character,
> however, it treats the character variable as a local variable. For instance,
> in Account:
>character = Character.create msg.capitalize, self
> save!

I assume this is within a method in the Account# scope?

> Checking character outside of that method returns nil, and the character_oid
> database field is NULL. I tried using self.character and experienced the same
> results.

the Account#character= method is defined by Og and handles the rel saving.

self.character = Character.create()
p @character, @character_oid
# save!
update(:only => [:character_oid]) # slight optimization

I'm quite sure that this doesn't treat the character as the local variable.
If you tried that before without success, I'm not sure what else can be
wrong, could you try that once more?


Feel the love

More information about the Nitro-general mailing list