kenshoten-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Dec-22 16:35 UTC
Auto-recognized DB fields for ''created'' && ''last_updated''
Could someone point me to some info on what database field names the framework automatically recognizes and handles? Is it correct that this would be in the scaffolding system? My feeble google searches have returned no love. I''d like to add a ''created'' and a ''last_updated'' field to one of my tables and have rails automatically handle them. (Much preferred than for me to manually write up SQL statements which just call ''now()'' conditionally). Thanks. Peter -- kenshoten-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2006-Dec-22 20:55 UTC
Re: Auto-recognized DB fields for ''created'' && ''last_updated''
> Could someone point me to some info on what database field names the > framework automatically recognizes and handles? Is it correct that > this would be in the scaffolding system?Add the following fields to your table... created_at :datetime updated_at :datetime I don''t remember where in the docs this is recorded, but it is there.> > My feeble google searches have returned no love. > > I''d like to add a ''created'' and a ''last_updated'' field to one of my > tables and have rails automatically handle them. (Much preferred than > for me to manually write up SQL statements which just call ''now()'' > conditionally). > > Thanks. > Peter > > -- > kenshoten-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 -~----------~----~----~----~------~----~------~--~---
Gustav Paul
2006-Dec-24 12:32 UTC
Re: Auto-recognized DB fields for ''created'' && ''last_updated''
Philip Hallstrom wrote:> >> Could someone point me to some info on what database field names the >> framework automatically recognizes and handles? Is it correct that >> this would be in the scaffolding system? > > Add the following fields to your table... > > created_at :datetime > updated_at :datetime > > I don''t remember where in the docs this is recorded, but it is there. >Here you go: http://api.rubyonrails.org/classes/ActiveRecord/Timestamp.html Gustav Paul> >> >> My feeble google searches have returned no love. >> >> I''d like to add a ''created'' and a ''last_updated'' field to one of my >> tables and have rails automatically handle them. (Much preferred than >> for me to manually write up SQL statements which just call ''now()'' >> conditionally). >> >> Thanks. >> Peter >> >> -- >> kenshoten-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 -~----------~----~----~----~------~----~------~--~---