Dealing with created_on and updated_on ?

0 views
Skip to first unread message

Davo

unread,
Feb 27, 2007, 2:56:26 AM2/27/07
to Ruby on Rails: Talk

Hi everyone,

I'm working through some of the books and all going fairly well...

But I'm just wondering why when you create a scaffold for a table why
it includes created_on/at and updated_on/at fields for the create and
edit modes ?

As these are internally updated fields they should not be exposed to
user access...

So how do I now take them out of the forms & let them create/update
themselves ?

TIA - Dave Porter

Conrad Taylor

unread,
Feb 27, 2007, 3:19:21 AM2/27/07
to rubyonra...@googlegroups.com
Hi Dave, how did you create these model(s)? Did you mean the create
and edit actions for the controller? In any case, you simply remove
this information from the view in question.

Good luck,

-Conrad

Scott

unread,
Feb 27, 2007, 8:19:30 AM2/27/07
to Ruby on Rails: Talk
created_on/at updated_on/at are magic column names used by
ActiveRecord. They store the date/date+time when the table for the
corresponding object is created/updated.

You sholdn't need them in the form at all. Those fields will be
updated automatically when you create, save, etc. on the model
object.

Scott

Have a look at the migration for the table. Yo

Reply all
Reply to author
Forward
0 new messages