Reputation: 361
How can I use the ActionView::Helpers::FormOptionsHelper
method time_zone_select
and have the selected value default to the current (system) timezone?
This works fine:
time_zone_select( "user",
"time_zone",
nil,
:default => "Pacific Time (US & Canada)" )
How can I replace Pacific Time (US & Canada)
with valid code for the current zone?
Upvotes: 2
Views: 1649
Reputation: 24337
You can use Time.zone.name, so:
time_zone_select(:user, :time_zone, nil, default: Time.zone.name)
Upvotes: 4