Time_zone in Rails without region

I am trying to use the time_zone_select with Rails, which displays select

  <%= f.time_zone_select(:time_zone) %> 

HTML output:

 <option value="Belgrade">(GMT+01:00) Belgrade</option> 

All my time intervals I was calculated using a separate rake task that stored the time zone as a string in my database in the format:

Europe / Belgrade

This causes problems editing the record, because time_zone_select does not store values โ€‹โ€‹in this region. What am I doing wrong or what can I do to get around this?


** More info ****

This rake task that I created creates and stores time zones using ActiveSupport :: TimeZone .

When I create the time zone object, the name attribute returns the string "Europe / Belgrade" , but the time zone assistant expects this value to be Belgrade "

+4
source share

Source: https://habr.com/ru/post/1436309/


All Articles