You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
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 the variables setted by the transaction inside the method at runtime.
Any way I can access the block scope from there inside?
Thanks
Andrea
Frederick Cheung
unread,
Sep 19, 2012, 3:41:59 AM9/19/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
Why not use an actual transaction? If you're generating some per
transaction value then pass it as an argument to the methods you're
calling inside the transaction.
Fred
> Thanks
>
> Andrea
Andrea Campolonghi
unread,
Sep 19, 2012, 3:46:52 AM9/19/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Fred.
The issue is that I should have to override lots of Model to support it.