Rails 3 - Validation for Time existence
问题 I have a model with a Time attribute. I want to check that time can not be empty (better choice probably would be to check that input is time but i have no ideas how to deal with that). I tried this validation: # id :integer not null, primary key # school_class_id :integer # meeting_time :time class Meeting < ActiveRecord::Base validates :meeting_time, :presence => { :message => "can't be empty!" } end Then i tried to check this in spec and this fails (empty time is ok but it should not be).