Displaying 2 results from an estimated 2 matches for "console_sandbox".
2006 Mar 08
0
script/console custom prompt
...irb.'') { |options[:irb]| }
opt.on("--prompt=[]", ''Use a different prompt for irb.'') {
|options[:prompt]| }
opt.parse!(ARGV)
end
libs = " -r irb/completion"
libs << " -r #{RAILS_ROOT}/config/environment"
libs << " -r console_sandbox" if options[:sandbox]
ENV[''RAILS_ENV''] = ARGV.first || ''development''
if options[:sandbox]
puts "Loading #{ENV[''RAILS_ENV'']} environment in sandbox."
puts "Any modifications you make will be rolled back on exit."
e...
2012 Apr 27
3
rails console --sandbox is only half-baked
...us about the full thread:
https://groups.google.com/forum/?fromgroups#!msg/sequel-talk/VjfJcTD6s3w/Lbrc2RqVuu8J
<https://groups.google.com/forum/?fromgroups#%21msg/sequel-talk/VjfJcTD6s3w/Lbrc2RqVuu8J>
Here is how sandbox is handled by ActiveRecord:
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
This only handles the default database as notice...