Solutions for const and enums per class in Ruby 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.

Mar 12, 2023

Why callbacks are bad in Rails models 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.

Feb 7, 2023