Tag: ruby on rails syntax

General validation options in Ruby

There are several common validation options: :allow_nil The :allow_nil option skips validation when the value being checked is nil. class Coffee < ApplicationRecord   validates :size, inclusion: { in: %w(small medium large),     message: “%{value} is not a valid size” }, allow_nil: true end See the message documentation for all message argument options. :allow_blank The […]