Created_on not working

CREATE TABLE jobs (
id integer primary key auto_increment,
username varchar(255),
email int(4) NOT NULL default 1,
renderer varchar(2) NOT NULL default ‘HW’,
version varchar(8) NOT NULL default ‘8.0’,
job_name varchar(255) NOT NULL default ‘’,
number_of_frames_per_task int(10) NOT NULL default ‘0’,
total_number_of_frames int(11) NOT NULL default ‘0’,
STATE tinyint(3) unsigned NOT NULL default ‘0’,
created_on timestamp,
updated_on timestamp,
index(id)
) ENGINE=InnoDB

ruby script/generate model job
ruby script/generate controller student
ruby script/generate scaffold job student

http://localhost/.../student/new has entries for created_on and
updated_on. I’d like these to be handled automatically. According to
the docs I’ve found, this should work. I tried it with the time
‘datetime’ instead of timestamp as stated by one doc, but it did not
change anything.

Thank you.

Jonathan D. wrote:

created_on timestamp,
updated_on timestamp,
index(id)
) ENGINE=InnoDB
http://localhost/.../student/new has entries for created_on
and updated_on. I’d like these to be handled automatically.

I know that Rails will automatically update a field called ‘updated_at’
if
you’re using AR for session management. I’ve copied in my script below.
I
haven’t used ‘created_at’ but I believe that works the same way. I’m
using
MySQL. I don’t know whether or not that’s a requirement.

hth,
Bill

create table sessions (
id int not null
auto_increment,
sessid varchar(255),
data text,
updated_at datetime default NULL,
primary key(id),
index session_index (sessid)
) engine=InnoDB;

On 11/19/06, Jonathan D. [email protected] wrote:

total_number_of_frames int(11) NOT NULL default ‘0’,
http://localhost/.../student/new has entries for created_on and
updated_on. I’d like these to be handled automatically. According to
the docs I’ve found, this should work. I tried it with the time
‘datetime’ instead of timestamp as stated by one doc, but it did not
change anything.

The scaffold generator doesn’t know about the magic nature of these
fields -
they will be filled in automatically, so you can go ahead and delete
them
from
the _form partial.


Matt J.
[email protected]
President/Technical Director, Acme Art Company (acmeartco.org)

On Sun, Nov 19, 2006 at 06:58:39PM +0100, Jonathan D. wrote:

STATE tinyint(3) unsigned NOT NULL default ‘0’,
created_on timestamp,
updated_on timestamp,
index(id)
) ENGINE=InnoDB

I’m not sure if this is the problem but created_on/updated_on are for
dates, whereas created_at/updated_at are for timestamps. Try renaming
the columns and see if it helps. Otherwise the logfiles may show what’s
going on.


Cheers,

  • Jacob A.

The scaffold generator doesn’t know about the magic nature of these
fields -
they will be filled in automatically, so you can go ahead and delete
them
from
the _form partial.

A cookie to Matt J… Thank you!

also,

i think its supposed to be
created_on date
created_at datetime

If this is mysql we’re talking about, if not, then nm

–jake

Jonathan D. wrote:

The scaffold generator doesn’t know about the magic nature of these
fields -
they will be filled in automatically, so you can go ahead and delete
them
from
the _form partial.

A cookie to Matt J… Thank you!