[Nitro] [Og] expected behaviour?

pedro gutierrez pedro.gutierrez at netcourrier.com
Thu Feb 15 08:23:43 EST 2007

Hi everybody,
My name is pedro, i am from spain, a ruby newbie, and a fan of nitro/ 
og !
This is my first post to the mailing list, I hope i will be clear and  
write correct english ..

I've tested a very simple scenario of the has_many/belongs_to  
relationship, and had some strange behaviour, so I wanted to check  
that the result I got is the one it is expected. Let met explain the  

a Topic contains many Sections
a Section belongs to a Topic

That's all. Now, I create (and save) a "topic1", then I create (and  
save) a "section" attached to "topic1". Everything is fine so far.

Then I create a second topic, named topic2, and save it.
Then I try to move section from topic1 to topic2, by doing:  
section.topic = topic1.

Immediately, Og issues an UPDATE sql statement in the form:
UPDATE ogsection SET name='update issue', topic_oid=2 WHERE oid=1

The thing is that this statement has been executed BEFORE I call the  
save method on the section!

Is that the expected behaviour? I was expecting that the changes  
where performed in memory, and then commited to the database when I  
do "section.save"

I've attached the source code of my test case.
please let me know if I am not very clear in my explanations, and  
thanks in advance for any help you could provide!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.rb
Type: text/x-ruby-script
Size: 1736 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20070215/4a481601/attachment.bin 
-------------- next part --------------

More information about the Nitro-general mailing list