Bah. Fixed it myself. In the user model, I had
"belongs_to :department". Changing it to "belongs_to
:departments"
fixed it. I still wonder, though, am I doing that right?
Thanks,
Sean
-------
Sean Hussey
Web Database Specialist
Berklee College of Music
617-747-2926
On Sep 5, 2005, at 1:28, Sean Hussey wrote:
> Hi everyone,
>
> I have users and departments. Users belong to departments and
> departments have many users. Good so far, right?
>
> In the user test fixture, I have "department: 1" for a particular
> user fixture. In the test database, there''s a corresponding
> department with an ID of 1. Still good?
>
> When I test:
>
> assert_equal 1, @user.department
>
> I get this:
>
> 1) Failure:
> test_create(UserTest) [test/unit/user_test.rb:18]:
> <1> expected but was
> <nil>.
>
> I''ve tried loading the departments fixtures into the user tests:
>
> fixtures :departments, :users
>
> Still no love. What am I missing? Why is @user.department nil?
>
> Thanks!
>
> Sean
>
> -------
> Sean Hussey
> Web Database Specialist
> Berklee College of Music
> 617-747-2926
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails