Displaying 1 result from an estimated 1 matches for "transaction_value".
2012 Sep 18
2
Access block scope from AR object
I need to create a sort of transaction around some Active Record objects 
that perform many insert/updates.
Example:
class MyObject
    def transaction &block
        @my_var = value         
        self.instance_eval block 
    end
end
MyObject.new.transaction do
    Model.create
    Model.collection.create 
    etc......
end
I have a gem that add a method into AR::Base and I need to read