diff --git a/lib/active_record/transitions.rb b/lib/active_record/transitions.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/transitions.rb
+++ b/lib/active_record/transitions.rb
@@ -26,7 +26,7 @@ module ActiveRecord
 
     included do
       include ::Transitions
-      before_validation :set_initial_state
+      after_initialize :set_initial_state
       validates_presence_of :state
       validate :state_inclusion
     end
diff --git a/test/test_active_record.rb b/test/test_active_record.rb
index <HASH>..<HASH> 100644
--- a/test/test_active_record.rb
+++ b/test/test_active_record.rb
@@ -3,7 +3,7 @@ require 'active_support/core_ext/module/aliasing'
 
 class CreateTrafficLights < ActiveRecord::Migration
   def self.up
-    create_table(:traffic_lights) do |t| 
+    create_table(:traffic_lights) do |t|
       t.string :state
       t.string :name
     end
@@ -59,6 +59,11 @@ class TestActiveRecord < Test::Unit::TestCase
     @light = TrafficLight.create!
   end
 
+  test "new record has the initial state set" do
+    @light = TrafficLight.new
+    assert_equal "off", @light.state
+  end
+
   test "states initial state" do
     assert @light.off?
     assert_equal :off, @light.current_state
New records have their state set after initialization

Initial state was set using before_validation, which resulted in a nil state
for new records. Instead of using the before_validate hook, use the
after_initialize hook to make sure the state is properly set.