Rails Bling
  • Posts
Introducing activerecord-transactionable

Properly Implement ActiveRecord Transactions Provides a method, transaction_wrapper at the class and instance levels that can be used instead of ActiveRecord#transaction. Enables you to do transactions properly, with custom rescues and retry, including with or without locking. Installation Add this line to your application’s Gemfile: gem 'activerecord-transactionable' And then execute: $ bundle Or install it yourself as: $ gem install activerecord-transactionable Usage class Car < ActiveRecord::Base include Activerecord::Transactionable # Note lowercase "r" in Activerecord (different namespace than rails' module) validates_presence_of :name end When creating, saving, deleting within the transaction make sure to use the bang methods (!

March 28, 2016 Read
Navigation
  • About
  • Skills
  • Experience
  • Projects
Contact me:
  • Email: peter.boling cinnamon roll symbol gmail.com
  • Phone: +1-925-252-5351

Toha
  • © 2020. All Rights Reserved.
Powered by Hugo Logo