This project is archived and is in readonly mode.

#3973 ✓committed

before_type_cast not available for datetime fields

Reported by iros | February 16th, 2010 @ 10:39 PM

ActiveRecord version: 2.1.0

Given an ActiveRecord with the following schema:

create_table :objects do |t|
  t.string      :key, :null => false, :unique => true
  t.datetime    :start_date

The following sequence will result in a nil value:

o =
o.start_date = "345643456" #invalid input, might want it to be caught by a validator
o.start_date => nil
o.start_date_before_type_cast => nil

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Referenced by