How to do a rollback


#1

Hi. I’d like to know how can i do a rollback after a
Table.new(params:id)?

thank you


#2

On 11/30/05, Christian G. removed_email_address@domain.invalid
removed_email_address@domain.invalid wrote:

Hi. I’d like to know how can i do a rollback after a
Table.new(params:id)?

You need to put it into a transaction:

Table.transaction do

Table.new(…)

more stuff

if you leave the block via an exception, the transaction is

rolled back, if you leave it normally it is committed…

end


#3

Thanks christian!
It worked like charm!