Ruby Forum Ruby on Rails > ActiveRecord::Rollback not found?

Posted by Praveen (Guest)
on 29.04.2008 16:39
(Received via mailing list)
Hi All
The docs mention that raising ActiveRecord::Rollback from within a
'transaction' block causes the transaction to rollback without
reraising it. However, trying this in script/console gives this error:

NameError: uninitialized constant ActiveRecord::Rollback

Doing a recursive grep of /usr/lib/ruby doesn't find any mention of
ActiveRecord::Rollback!! Am I doing something wrong? What's the
'right' way to rollback a transaction explicitly from within a
'transaction' block?

thanks
Posted by Frederick Cheung (Guest)
on 29.04.2008 17:36
Attachment: smime.p7s (3,9 KB)
(Received via mailing list)
On 29 Apr 2008, at 15:38, Praveen wrote:

>
> Hi All
> The docs mention that raising ActiveRecord::Rollback from within a
> 'transaction' block causes the transaction to rollback without
> reraising it. However, trying this in script/console gives this error:
>
> NameError: uninitialized constant ActiveRecord::Rollback
>
Well it's defined in Activerecord's base.rb (it just defined as class
Rollback (but inside the AR module) which is why your search didn't
find it).
and ActiveRecord::Rollback seems to exist for me.

Fred