# Auto-recognized DB fields for 'created' && 'last\_updated'

**URL:** <https://www.ruby-forum.com/t/auto-recognized-db-fields-for-created-last-updated/80247>\
**Category:** Rails\
**Created:** [December 22, 2006, 8:40pm UTC](https://www.ruby-forum.com/t/auto-recognized-db-fields-for-created-last-updated/80247 "2006-12-22T20:40:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [December 22, 2006, 8:40pm UTC](https://www.ruby-forum.com/t/auto-recognized-db-fields-for-created-last-updated/80247/1 "2006-12-22T20:40:17Z")

</div>

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

–  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [December 22, 2006, 10:40pm UTC](https://www.ruby-forum.com/t/auto-recognized-db-fields-for-created-last-updated/80247/2 "2006-12-22T22:40:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [December 24, 2006, 1:31pm UTC](https://www.ruby-forum.com/t/auto-recognized-db-fields-for-created-last-updated/80247/3 "2006-12-24T13:31:46Z")

</div>

Philip H. wrote:

> I don’t remember where in the docs this is recorded, but it is there.

Here you go:

> **[ActiveRecord::Timestamp](https://api.rubyonrails.org/classes/ActiveRecord/Timestamp.html)**
>
> Active Record Timestamp Active Record automatically timestamps create and update operations if the table has fields named created\_at/created\_on or updated\_at/updated\_on.

Gustav P.
