Let me ask for a little help. I would like to know how this situation
could be handled in Rails.
Here is the point: I have an application (Java nowadays) that uses two
master resources: a Data base and an ECM
In situations like that, generally the user selects the document to be
stored (PDF, IMAGE, DOC, etc), the application stores it in the ECM,
getting the DOC_ID, and writes a DOC_ID reference in the database in
one or more of the business model tables.
And here comes the problem. There is not a unified transaction control
between the database and the ECM.
Theoretically the act of writing in the ECM and the act of writing in
the database should be under the control of the same transaction. Any
problem and EVERYTHING should be undone.
In Java, that is easy, well, better to say feasible, because the
solution was using EJBs. I have created an EJB for each writing, one
EJB for writing in the ECM and other for writing in the database, and
a third to group the previous two. That way, this third EJB becomes
responsible to the whole transaction control.
How could it be done in Rails? Should I control it manually? Or does
Rails have any kind of transaction control container that can handle
In this example, if something goes wrong in the last writing action
(which depends on how the ECM works), the first writing action should
be undone by the application?