How to validate inclusion of time zone?
- by LearningRoR
When I try:
validates_inclusion_of :time_zone, :in => TimeZone
validates_inclusion_of :time_zone, :in => Time.zone
This error appears:
"<class:User>": uninitialized constant User::TimeZone (NameError)
I'm trying to let users select any time zone of the world but since I'm based in the U.S.A. my select menu is this:
<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones, {:prompt => "Select Your Time Zone *"}, {:id => "timezone"} %>
What's the correct way to do this?
Thank you.