ActiveRecord anti-patterns which you should avoid. Part 1: Conditional validations
Imagine that you develop an e-commerce platform. Your basic model is Order.
You would have some constraints which don't have to be valid before order is placed:
validates :order_items, length: {minimum: 1}, unless: :cart?
validates_presence_of :deliv...
rubywizards.com2 min read