I have a simple time zone field in a form like so:
<div class="field">
<%= f.label :time_zone %><em> (appointment times will be displayed in your timezone)</em><br>
<%= f.select :time_zone, time_zone_options_for_select(f.object.time_zone, nil, ActiveSupport::TimeZone), {include_blank: true}, class: "form-control" %>
</div>
I have read elsewhere best practice is to prepopulate the field with the timezone of the IP address of the user, and that will be accepted by the user 99% of the time (and in cases where it isn't the user's timezone, they can simply change it)
How do I achieve this in a ruby on rails app?