a.) there is an application for this
gem "validates_date_time", :git => "git://github.com/sofatutor/validates_date_time", :branch => 'rails-3'
b.) I donβt actually use this stone because I found this convenient model method in front of the gem
class KeyPerson < ActiveRecord::Base validate :started_at_is_date? private def started_at_is_date? if !started_at.is_a?(Date) errors.add(:started_at, 'must be a valid date') end end end
where :started_at is the name of the column. This is a bit of ruby ββmagic / chaos for you with a dynamic name processing method.
source share