Hi everyone,

I'm new with ruby and datamapper (I'm a Java and Python developer), and I'm
giving the ruby world a shot.

I sadly didnt find the answer  in the docs (very very strange indeed), and
after some search I found the answer in the group, but its from 3 years ago,
maybe something has changed. How can I use transactions with datamapper? I
always start a transaction from a current instance? What happens if i want
to change the state of multiple entities?

What i found is:

To wrap simple stuff inside a *transaction* you do:

myInstance.*transaction* do
  myInstance.some_value = some_other_value
  myInstance.do_something
end

To wrap several updates of several instances in side a *transaction* you do:

myInstance.*transaction*.*link*(anotherInstance) do
  myInstance.some_value = some_other_value
  anotherInstnace.some_value = some_other value
end

---

Why the transaction is attached to the instance? The "link" API is very
weird. Wouldn't be nicier a global method to start/commit/rollback
transactions? And how can I force a rollback?

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to