[LRUG] How does Rails decide how to parse ambiguous dates?

Paul Robinson paul at 32moves.com
Wed Jul 27 01:30:11 PDT 2011


On 26 Jul 2011, at 17:43, John Winters wrote:

> Yes, that's a nice idea, but it still leaves unanswered the question of how to get an existing date formatted like that in the text field.


Wait, what?

Your database column is a date type right? Not just a varchar?

So by "text field" I'm assuming you mean the text input on the form. But the Rails i18n helpers should look after that for you. So what is it specifically that isn't working?


> As far as I've been able to discover, Rails provides no facilities to control that formatting, and what you'll get in your field by default is the raw database format.  Obviously there are lots of ways of overriding this, but what I've been trying to do is find the Correct Rails Way(TM) to achieve it.


If you input it into a string column, you might be right. But a date column and the i18n way seems to be fine here...


More information about the Chat mailing list