Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 - Time zone dropdown with only US zones

I know there is this

<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %>

but it returns all timezones but has the US on the top. I only want the US ones and I can't seem to figure out if there is a way to use this with select_tag or collection_select without me building my own hash. Very interested in knowing. Thanks all!

like image 814
bokor Avatar asked Feb 12 '11 07:02

bokor


1 Answers

This should do the trick:

<%= f.collection_select :time_zone, ActiveSupport::TimeZone.us_zones, :name, :to_s %>
like image 114
idlefingers Avatar answered Nov 05 '22 06:11

idlefingers