Topic: validates_numericality_of and foreign key

Hi everyone,

When I include 'validates_numericality_of' in a model, and specify a foreign key field, I get an error

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:1238:in `method_missing': no id given (ArgumentError)
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb:1238:in `method_missing_without_whiny'
        from /Users/bt/rails_projects/your_life_market/vendor/plugins/whiny_finder/lib/whiny_finder.rb:25:in `method_missing'
        from /Users/bt/rails_projects/your_life_market/app/models/user.rb:3
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:104:in `require_or_load'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:60:in `depend_on'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:442:in `require_dependency'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/fixtures.rb:486:in `require_fixture_classes'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/fixtures.rb:482:in `each'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/fixtures.rb:482:in `require_fixture_classes'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/fixtures.rb:477:in `fixtures'
        from test/unit/user_test.rb:4

when I run a unit test such as
def test_invalid_user_creation
    u = User.new
    assert !u.valid?
  end

Anyone know what I could be doing wrong? I have a fixture for this foreign key, that has 5 records present, although I'm not doing any sort of Find from another Model. I'm stumped! If I remove 'validates_numericality_of', the test will pass.

TIA,

Brandon Taylor
Sr. Developer

Dell