begin
rescue
define transaction() yield end
transaction do
x = 42
end
puts x # This will cause an error because `x` is not defined here.
x = nil
transaction do
x = 42
end
puts x # Will print 42
begin
object = nil
transaction do #Code inside transaction
object = Class.new attributes
raise unless object.save!
end
rescue
puts object.error.full_messages # Why can't we use local varible inside rescue ?
end