[LRUG] How does Rails decide how to parse ambiguous dates?
John Winters
john at sinodun.org.uk
Tue Jul 26 08:39:35 PDT 2011
On 26/07/11 16:07, John Winters wrote:
[snip]
> def read_attribute_before_type_cast(attr_name)
> @attributes[attr_name]
> end
>
> Unless I've missed it somewhere, no formatting at all occurs.
I'm back to my earlier view that no formatting occurs in the field
handling code, but there is some sort of conversion happening in
ActiveRecord and I'm at a loss as to where.
I have a model called an era, and it has a Date field called starts_at.
I've fire up the console and get the following (prompt shortened for
clarity):
> era.starts_at.class
=> Date
> era.attributes["starts_at"].class
=> Date
> era.read_attribute_before_type_cast("starts_at").class
=> String
Now where did that conversion occur?
John
More information about the Chat
mailing list