Skip to content

Instantly share code, notes, and snippets.

View danielmurphy's full-sized avatar

Daniel Murphy danielmurphy

View GitHub Profile
@harlow
harlow / user.rb
Last active November 16, 2023 15:13
Extract a validator in Rails. Zip code validation.
# app/models/user.rb
class User < ActiveRecord::Base
validates :zip_code, presence: true, zip_code: true
end