David W Parker - Developer


Rails text_field tag with datetime data gotcha

published on

Another quick gotcha that I just discovered. If you have a model that has a time on the backend, be careful which tags you use. In my case, I have an app that is outside UTC:

config.time_zone = 'Central Time (US & Canada)'

On my form, when editing the model, everything appears fine. But when you check out the difference in these two tags, you’ll see that text_field renders the incorrect time, whereas datetime_select renders the correct time.

= f.datetime_select :posted_at
= f.text_field :posted_at

I put in a defect ticket for this here. Hopefully the Rails team will be able to knock that out quick.

Questions? E-mail me: this domain AT gmail DOT com