I’m working with an app for a concert tour website
where all times (announcement times, on-sale start times, and event
times) are local to each particular venue’s time zone. I take the user
entered date/time where applicable and run a before_filter to set the
appropriate time zone so that everything is stored in the database in
For the ‘new’ form and for displaying the times in index and show
no problem at all. When the data is brought back out of the database and
into a view, I use in_time_zone to adjust per the particular venue.
The only issue is on the edit form. The date/time select is showing the
in UTC. When I’m working on the site, I mentally adjust, but for others
confusing. I’d like to do something along the lines of:
<%= f.datetime_select :start_datetime.in_time_zone(@event.time_zone) %>
Or, in the controller:
@performance = Performance.find(params[:id])
@event = @performance.event
Then simply, <%= f.datetime_select :start_datetime %>.
Unfortunately, I haven’t found the right way to do this. Do you have any
ideas worth giving a shot?
Thank you very much.