Module: Arql::Commands::Sandbox
- Defined in:
- lib/arql/commands/sandbox.rb
Class Attribute Summary collapse
-
.enabled ⇒ Object
Returns the value of attribute enabled.
Class Method Summary collapse
Class Attribute Details
.enabled ⇒ Object
Returns the value of attribute enabled.
4 5 6 |
# File 'lib/arql/commands/sandbox.rb', line 4 def enabled @enabled end |
Class Method Details
.enter ⇒ Object
10 11 12 13 14 |
# File 'lib/arql/commands/sandbox.rb', line 10 def enter ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback(:checkout, :after, &@sandbox_callback) ActiveRecord::Base.connection.begin_transaction(joinable: false) @enabled = true end |
.quit ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/arql/commands/sandbox.rb', line 16 def quit ActiveRecord::ConnectionAdapters::AbstractAdapter.skip_callback(:checkout, :after, &@sandbox_callback) @enabled = false puts "begin_transaction callbacks removed." puts "You still have open %d transactions open, don't forget commit or rollback them." % ActiveRecord::Base.connection.open_transactions if ActiveRecord::Base.connection.open_transactions > 0 end |