# Date store problem in rails 2.0

**URL:** <https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852>\
**Category:** Rails\
**Created:** [August 26, 2008, 7:59am UTC](https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852 "2008-08-26T07:59:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 26, 2008, 7:59am UTC](https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852/1 "2008-08-26T07:59:04Z")

</div>

I am facing one strange problem with date\_select tag. I am using it for  
getting birth date from user.

I am using rails 2.0.2, and to save birth date in database, I am using  
DATETIME as datatype. But when I put year below 1970, it gives me  
database error as "ActiveRecord: :MultiparameterA ssignmentErrors ".

What can be the problem for it? What is the solution for it?

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 26, 2008, 11:17am UTC](https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852/2 "2008-08-26T11:17:39Z")

</div>

On 26 Aug 2008, at 06:59, Sunny B. wrote:

> I am facing one strange problem with date\_select tag. I am using it  
> for  
> getting birth date from user.
> 
> I am using rails 2.0.2, and to save birth date in database, I am using  
> DATETIME as datatype. But when I put year below 1970, it gives me  
> database error as "ActiveRecord: :MultiparameterA ssignmentErrors ".

Probably because you’re on a platform where ruby’s Time class can’t  
represent times before 1st Jan 1970. Ruby’s DateTime class does not  
have this limitation. You could override the mapping of DateTime  
columns in the adapter file for your database.

Fred

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 26, 2008, 11:31am UTC](https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852/3 "2008-08-26T11:31:12Z")

</div>

Can you give a detail solution for this I am not able to understand it.

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 26, 2008, 11:49am UTC](https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852/4 "2008-08-26T11:49:21Z")

</div>

On 26 Aug 2008, at 10:31, Sunny B. wrote:

> Can you give a detail solution for this I am not able to understand  
> it.

If in schema\_definitions.rb you change the klass function to return  
DateTime instead of Time then you shouldn’t have this problem

Fred

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 26, 2008, 11:50am UTC](https://www.ruby-forum.com/t/date-store-problem-in-rails-2-0/146852/5 "2008-08-26T11:50:32Z")

</div>

On 26 Aug 2008, at 10:48, Frederick C. wrote:

> On 26 Aug 2008, at 10:31, Sunny B. wrote:
> 
> > Can you give a detail solution for this I am not able to understand  
> > it.
> 
> If in schema\_definitions.rb you change the klass function to return  
> DateTime instead of Time then you shouldn’t have this problem

I should add that rails 2.1 fixes this properly - it might be cleaner  
to lift the fix from 2.1 than do what I suggested above.

Fred
