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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Dobbie 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; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/19/06, Jonathan Dobbie <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > 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.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 Jones mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org President/Technical Director, Acme Art Company (acmeartco.org) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sun, Nov 19, 2006 at 06:58:39PM +0100, Jonathan Dobbie wrote:> > 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=InnoDBI''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 Atzen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> 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 Jones. Thank you! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Dobbie 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 Jones. Thank you!-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---