Forum: Ruby on Rails RoR problems with Created_At and PostgreSQL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
166f431a24052a884b71b1274e551481?d=identicon&s=25 Johannes Hass (khaja)
on 2006-03-17 01:43
So, I wrote some pages which essentially created some articles which are
saved to a database, which also include both the "magic" rows
'created_at' and 'updated_at'.

Now, on my development machine I'm running the MySQL-database and
everything worked as I wanted it to. On the live server I've had to
switch to PostgreSQL 8.1 due to some horrendous dependencies.

Now, the weird thing is that everything works fine - save for the
'created_at'-timestamp. The 'updated_at'-timestamp is indeed updated as
it should. Both are created by the exact same SQL statement and differ
only by name.

Ruby is Version 1.8.4, Rails is at 1.0.0

Any pointers as to what I might be doing wrong? I could of course set
the timestamp myself...
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-03-17 03:05
(Received via mailing list)
On Fri, 2006-03-17 at 01:43 +0100, Johannes Hass wrote:
> it should. Both are created by the exact same SQL statement and differ
> only by name.
>
> Ruby is Version 1.8.4, Rails is at 1.0.0
>
> Any pointers as to what I might be doing wrong? I could of course set
> the timestamp myself...
----
see if created_on works for you.

Craig
166f431a24052a884b71b1274e551481?d=identicon&s=25 Johannes Hass (khaja)
on 2006-03-17 12:08
Craig White wrote:
> On Fri, 2006-03-17 at 01:43 +0100, Johannes Hass wrote:
>> it should. Both are created by the exact same SQL statement and differ
>> only by name.
>>
>> Ruby is Version 1.8.4, Rails is at 1.0.0
>>
>> Any pointers as to what I might be doing wrong? I could of course set
>> the timestamp myself...
> ----
> see if created_on works for you.
>
> Craig

I just found the error myself. You may not set a default value for the
timestamp  column 'created_at' - if there's a default value it will
_always_ be used.
B9a732fc30c32098347a0177c75ee27b?d=identicon&s=25 Jeroen Houben (Guest)
on 2006-03-17 12:19
(Received via mailing list)
Johannes Hass wrote:
>> see if created_on works for you.
>>
>> Craig
>
> I just found the error myself. You may not set a default value for the
> timestamp  column 'created_at' - if there's a default value it will
> _always_ be used.
>

I had this problem too. http://dev.rubyonrails.org/ticket/2257

Jeroen
This topic is locked and can not be replied to.