I came across a scenario where in other languages โโI would separate the model object from the transaction, then I can change everything I want without worrying about updating the record automatically.
Question
Do the rails do not support attaching / detaching a model object?
Which alternative, just duplicate the object?
EDIT
Scenario
We are reading models from the database, and we want to make changes to them that will not be stored in the database at the end of the transaction. In Hibernate \ JPA etc. You disconnect the model (Entity), and there will be no changes.
Now you may ask, why not use Model.dup? The answer is that we still need the model identifier, but as soon as you assign the identifier, the rails assume that this instance is now a model and updates the record at the end of the transaction.
thank
source
share