Actually you need to put that in an exception block. You are saving the data before the raise.
On Jul 23, 10:45 am, Carlos Forero <ecarlosfor...@gmail.com> wrote: > With : > PostgreSQL 8.4 or postgresql-8.3 > rails 2.3.4 > pg 9.x or pg 8.x > > I test this code: > ========================= > class NkiBatch < ActiveRecord::Base > Bank.connection.transaction do > > bank = Bank.new(:name => "ddsjdsjdsjk") > bank.save! > raise ActiveRecord::Rollback.new > end > end > > and this: > ========================= > class NkiBatch < ActiveRecord::Base > Bank.connection.transaction do > > bank = Bank.new(:name => "ddsjdsjdsjk") > bank.save! > raise Exception.new > end > end > > and this: > ========================= > class NkiBatch < ActiveRecord::Base > Bank.connection.transaction do > > bank = Bank.new(:name => "ddsjdsjdsjk") > bank.save! > raise "Please, rollback" > end > end > > but the record bank is saved succesfully into database > > (I reported the problem in the community of pg driver, but they > demonstrated that the problem is not the pg > driverhttp://bitbucket.org/ged/ruby-pg/issue/37/fail-rollback-transaction-w...) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.