Date store problem in rails 2.0

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?

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

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

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

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

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