auto set value for a model field

I have a model - Post with datetime field <added_at>. I need to set this value to time when in created or when it updated automatically.

Why not use the fields created_at and updated_at and let Rails do this for you?

Hi Igor

Philip is right.Just add created_at or created_on updated_at or updated_on

in your table.

That's it :slight_smile:

Hi Igor

Being opinionated,Rails had already decided on auto-updating on create and on update separately :slight_smile: