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.
Johannes H. (Guest)
on 2006-03-17 02: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...
Craig W. (Guest)
on 2006-03-17 04:05
(Received via mailing list)
On Fri, 2006-03-17 at 01:43 +0100, Johannes H. 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
Johannes H. (Guest)
on 2006-03-17 13:08
Craig W. wrote:
> On Fri, 2006-03-17 at 01:43 +0100, Johannes H. 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.
Jeroen H. (Guest)
on 2006-03-17 13:19
(Received via mailing list)
Johannes H. 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.