I am new to ActiveRecord and trying to do something fairly simple. I searched the internet and was unable to come up with a solution.
In mysql I have a table column with a type of DATETIME. This table has many values in it already. Some example values for this column are NULL, 0000-00-00 00:00:00, and 2009-04-30 10:30:22
Using rails and ActiveRecord I can retrieve records from the database. However, when I ask for the value of a DATETIME field with the value of 0000-00-00 00:00:00 the result I get is a nil object.
A database value of NULL also returns a nil object, which makes sense.
A database value of 2009-04-30 10:30:22 returns Thu, 30 Apr 2009 10:30:22 UTC +00:00 which also makes sense.
I thought using _before_type_cast might help, but it does not.
How can I determine if the object returned has a database value of 0000-00-00 00:00:00?