Dealing with created_on and updated_on?

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 P.

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs