Em 26-04-2012 14:51, Jeremy Evans escreveu:
On Thursday, April 26, 2012 7:20:49 AM UTC-7, Rodrigo Rosenfeld Rosas wrote:I've just remembered another use case for this requested feature. In Rails you can start the console inside a transaction with rails console --sandbox This is how it is implemented in Rails: activerecord/lib/active_record/railties/console_sandbox.rb: ActiveRecord::Base.connection.increment_open_transactions ActiveRecord::Base.connection.begin_db_transaction at_exit do ActiveRecord::Base.connection.rollback_db_transaction ActiveRecord::Base.connection.decrement_open_transactions end See how limited Sequel is by not allowing the start-finish of transactions in separate pieces of code? Although this practice shouldn't be recommended, developers should be allowed to do this if they wanted to. There are some situations, like the sandbox above and the RSpec before(:all), where this is very handy. Sorry, I haven't tested your workaround over this limitation yet because I still couldn't find free time, but I thought I should mention this other use case now that I've remembered about it.This is trivially handled by starting the IRB shell inside a transaction block. For the same reason, your RSpec case could be trivially handled by if they implemented around(:all).
Yes, I know but I don't have any control over any of those APIs (Sequel, Rails and RSpec). I just know this is a limitation of Sequel that won't allow me to use transactions in situations I can't handle them using blocks.
I can't rewrite every single software because they were not intended to work with the Sequel way of dealing with transactions.
I hope you understand what I mean. Best, Rodrigo. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
