# Activerecord update\_attributes have a strange action with date

**URL:** <https://www.ruby-forum.com/t/activerecord-update-attributes-have-a-strange-action-with-date/154425>\
**Category:** Rails\
**Created:** [November 29, 2008, 12:18pm UTC](https://www.ruby-forum.com/t/activerecord-update-attributes-have-a-strange-action-with-date/154425 "2008-11-29T12:18:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a3d4f5/32.png) [@wuz](https://www.ruby-forum.com/u/wuz)\
**Post date:** [November 29, 2008, 12:18pm UTC](https://www.ruby-forum.com/t/activerecord-update-attributes-have-a-strange-action-with-date/154425/1 "2008-11-29T12:18:22Z")

</div>

I am using activerecord 2.1.0 and mysql,and with mysql 2.7 driver.  
I have seen that when I use update\_attributes,the date value have a  
strange action.

Think we have a table Tests with  
id int,  
dt datetime

and when I use,  
a[:dt] = “20081128”  
test = Test.new  
test.update\_attributes(a)

it ran ok,

but when I set the date value to “31000101”  
the dt had been set to NULL.

anyone have same problem?
