Alexander Kireyev
Alexander Kireyev

Reputation: 10825

Selectbox with Timezones in Rails 3.1

I want to make selectbox like this with simple_form (but it doesn't matter I think). I found that in Rails 2.1 was object TimeZone.us_zones but now it doesn't work neither Time.zone.all or smth. The line example for simple_form:

  = f.time_zone :time_zone, TimeZone.us_zones

And I should have a time_zone field string format in db sqlite?

Upvotes: 2

Views: 587

Answers (2)

Alexander Kireyev
Alexander Kireyev

Reputation: 10825

Works without any collection

  = f.time_zone_select :time_zone

Upvotes: 1

user3582386
user3582386

Reputation: 21

Maybe this can be helpful as well

<li> <%= f.label :time_zone %><%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones, :class => :timezone %> </li>

Upvotes: 2

Related Questions