Transactions in Rails / Active Record
1 transaction do 2 david.withdrawal(100) 3 mary.deposit(100) 4 end
DZone Snippets > peter > database
12738 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Peter Cooperx http://www.petercooper.co.uk/
1 transaction do 2 david.withdrawal(100) 3 mary.deposit(100) 4 end
1 REPAIR TABLE tbl_name QUICK;
1 ActiveRecord::Base.connection.select_one('select sum(quantity) from table').to_i 2 arrayofhashes = ActiveRecord::Base.connection.select_all('select * from table')