validates_inclusion_of no longer working the same in Rails 4.1?

前端 未结 3 1327
花落未央
花落未央 2020-12-31 20:29

The following code made sure that a time_zone chose is within the time zones in ActiveSupport::TimeZone.us_zones:

validates_inclusi         


        
3条回答
  •  一整个雨季
    2020-12-31 21:18

    try adding .keys ?

    validates :time_zone, 
      inclusion: { 
        in: ActiveSupport::TimeZone.zones_map.keys 
      } 
    

提交回复
热议问题