Tag Archives: DSL

Normalizing ActiveRecord attributes with a custom DSL – Learn from Tutorial

Normalizing ActiveRecord attributes with a custom DSL Lately, I’ve been reading through some Rails code that I’ve written for my side-projects. After reading through 4-5 projects, I noticed a common pattern that could be extracted and reused throughout the application. The pattern goes something likes this, class User < ApplicationRecord before_validation :normalize_fields private def normalize_fields…

Read More