[Nitro] [Og] expected behaviour?

Jonathan Buch john at oxyliquit.de
Thu Feb 15 11:45:00 EST 2007

Weclome Predro!

> 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"

This looks like a bug in the code:

og/relation/refers_to.rb:65:  save unless self.unsaved?

So, save when the current object is already saved.  I'm not getting
the all implications yet of removing that line, but it shouldn't
hurt much.

Og.setting :autosave_relations, :default => false ?

Or does that look like overload... :P  George?


Feel the love

More information about the Nitro-general mailing list