On 04/18/2011 01:24 PM, Jeremy Evans wrote:

On Apr 18, 1:07 pm, Joel VanderWerf<[email protected]>  wrote:
...
Foo.create do |foo|
    foo.bar = Bar.create do |bar|
      bar.baz = Baz.create do |baz|
        defer<<  proc do
          baz.foo = foo
          baz.save
        end
      end
    end
end

I think this is a simpler way to do things:

   baz = Baz.create
   bar = Bar.create(:baz=>baz)
   foo = Foo.create(:bar=>bar)
   baz.update(:foo=>foo)

Thanks, that confirms that this sequence of four steps is essential.

The business with blocks and defer is the residue of a more complex system that has more to do with the hierarchical structure of the data I'm importing (xml) than with the database...

--
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to