Strange ActiveRecord mapping problem

Hi,

I have a strange ActiveRecord mapping problem.

I have a mysql table that contains (among other things) a date field.
Previously, ActiveRecord mapped that date field to a Date object.

I then changed two things : I added a callback function (before_save) on
my model, and I added another date field in the mysql table. The
callback function is suppose to take the first date, then calculate and
store the second date in the db.

After making these changes, ActiveRecord maps my first date field to a
Time object, and not a Date object anymore.

If I perform a SHOW FIELDS FROM my_table manually using phpmyadmin, I
can see that mysql say it’s date type.

I can probably find a solution easily, but I’d like to understandwhy
rails work like that.

Thanks in advance

Nicolas

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