desc 'do not permanently write on the db (good for testing rake tasks)'
task :sandbox => :environment do
puts "** << USING SANDBOX!! >> **"
# beginning
ActiveRecord::Base.connection.increment_open_transactions
ActiveRecord::Base.connection.begin_db_transaction
# end
at_exit do
ActiveRecord::Base.connection.rollback_db_transaction
ActiveRecord::Base.connection.decrement_open_transactions
end
end
Tech stuff around computer programming, basically for web development, especially opensource. Topics will go round Ruby on Rails (git gems etc.), Ubuntu (admin and basic shell) and work organization (agile philosophy)
Saturday, 23 February 2013
rails sandbox tasks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment