Noob validation question for time_zone

Despite much googling and book checking, I can’t for the life of me
figure out how to check if the time_zone object is nil. The situation
is that I built a fun little delayed email delivery app –
if you’re interested – and want to ensure that the user selects his
time zone. I can validate, throw errors on, and rescue all the other
form fields. I tried checking in the before_filter that creates the
time zone object, in the create method, but no dice. I think I’m just
not understanding some of the basics - so I’m sorry if this isn’t even
a meaningful question. Would it help if I posted controller code?

You can do validates_presence_of :time_zone in the relevant model to
ensure that the field is not left blank.

2009/6/12 Jon [email protected]:

validates_presence_of will check that a value has been entered for a
field so may do what you are looking for.


Thanks Ryan, Colin – I should have gone with my first instinct to
validate in the model. Works now!