has_dates padding?

6 views
Skip to first unread message

Pawel Szymczykowski

unread,
Feb 3, 2011, 1:51:12 PM2/3/11
to SimpleRecord
Hey Travis,

Where in the code does the has_dates padding occur? I'm getting some
funny behavior where my dates are being stored like this:

-4712-01-01

when I store a Date or DateTime in that column. I'd also probably like
some more padding on my has_ints fields, so I'd like to get into that
code, but not totally sure where to look. I'll probably fork and
submit some patches back up to you along with that Rails 3 partial
issue I found the other day.

Thanks!

Pawel Szymczykowski

unread,
Feb 3, 2011, 7:26:34 PM2/3/11
to SimpleRecord
And it turns out I was being dumb and calling Date.new() instead of
Date.today() - sorry. :)

The other problem I was having was converting stringified dates to
DateTime()'s before insertion. I thought I saw a piece of code to do
that, but couldn't get it to work. I ended up having to add the
following to my model:

def published_on=( date )
if date.is_a?( String )
@attributes['date'] = DateTime.parse( date )
else
@attributes['date'] = date
end
end

I made myself a TODO to look back into this, but in the mean time I
just need to get a proof of concept together.
Reply all
Reply to author
Forward
0 new messages