-
Replace case-statements with dry-matchers
Gem
dry-matcheroffers very flexible and robust pattern matching API for Ruby. While the gem has many interesting use-cases I would like to focus on very specific one: Using a matcher instead of standard conditional structures likeiforcase. -
Backing Rails enums with Postgres ENUM type
Rails introduced
enumin version 4.1. It’s a handy feature, which lets you describe any trait of an object in a very friendly and human readable way. If you need to keep track of the state of an entity, you will most likely add a field to the model and store a value there.