rails/rails — pull request #12683 by ancorcruz (2013-10-28 23:31:18+00:00)
Title: Fixed behavior of `validates_numericality_of` validation `even` and `odd` options with not true values

Validation will look like:

class Booking < ActiveRecord::Base
validates :guests, numericality: { integer_only: true, even: :even_only?, greater_than: 1 }

def even_only?; return true or false; end
end

instead of:

class Booking < ActiveRecord::Base
validates :guests, numericality: { integer_only: true, greater_than: 1 }
validates :guests, numericality: { even: true }, if: :even_only?

def even_only?; return true or false; end
end