0

I am trying to get transactions to work because I need to save the @event so I can assign the given @event.id to its dependents.

I have raise ActiveRecord::Rollback, but it doesn't do anything. I know it hits it too because it displays the :notice entered befor that. Another problem I found online was not raising an exception. I started to use save! to throw an exception. This gives me an exception ActiveRecord::RecordInvalid and when i rescue the exception it doesn't rollback. Im grateful for any help or ideas thank you.

NOTE: The second half of this transaction is what to do if the @EVENT already exists. I have not debugged that part yet because the event is never going to exist until I can get this transaction working

  • Did my answer help at all @user1977840 ? – MrYoshiji Jan 28 '13 at 20:46
  • when you say raiser do you mean raise ActiveRecord::Rollback to stop the transaction? –  Jan 28 '13 at 21:19
  • No the `raiser "error"` method allows you to raise custom errors (in this case it will show "Error: 'error'" – MrYoshiji Jan 28 '13 at 21:22
  • But i dont want to stop the code from executing. I just want any changes to the Database be reversed and then go back to the previous page and display the error. I already have the errors collected but when i go back the event and some lots are still in my DB which is garbage data then –  Jan 28 '13 at 21:27

1 Answers1

1

Found out it was that MySQL sever was running a MyISAM engine, which does not support transactions.