[Nitro] The has_one/belongs_to relationship
Arne Brasseur
arne at arnebrasseur.net
Sat Aug 18 04:27:05 EDT 2007
Matthew B Gardner schreef:
> Hello, I've tried rather hard to figure this relationship out, but I just
> can't get it to work correctly on the has_one end. I have some classes that
> utilize the has_many/belongs_to relationship, and those work fine.
>
> The two classes are:
>
> class Account
> has_one :character, Character
> end
>
> class Character
> belongs_to :account, Account
> end
>
> When I initialize Character, I assign the passed account to its account
> variable, and the relationship is established (and saved properly to the
> database). 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!
>
> 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.
>
I would love to help you but I don't know much about Og though. The lead
developer George is currently on vacations, he should be back in a few
days. If you don't get an answer by then please ask again.
The other Og guy Jonathan just finished his job in Finland, I imagine
he's also taking a break.
I notice some new blood on the mailing list, welcome to Nitro! Please
hang on if it takes a while to get your questions answered and issues
solved. Things move slow around here sometimes. On the other hand I have
spoken to George recently and he's planning to devote more time to
Nitro, in fact he's working on it right now while on vacations.
My contract ends in a week, from September on I will be studying abroad.
That should also give me more time for Nitro.
Please keep sending any stories of success or failure. If you have a
small app that exhibits a problem, feel free to just send the whole app.
We'll analyze it together, should be educational for all.
(ab)
--
Arne Brasseur
http://www.arnebrasseur.net
arne at arnebrasseur.net
More information about the Nitro-general
mailing list