optimistic-locking
optimistic-locking
ruby
Solutions for const and enums per class in Ruby
Three ways to define constants and enums per class in Ruby: the ActiveRecord enum macro, a mixed style combining frozen constants with enum, and a dependency-free PORO version. Code for each solution and a comparison to help you pick the right one.
ruby
Why callbacks are bad in Rails models
ActiveRecord callbacks bring tight coupling, slower transactions, and painful debugging. Why before_save and after_save hooks in Rails models cause trouble, and how replacing them with an explicit process class makes the same flow readable and easy to debug.