Weird relationship behavior on Rails 3 and update_attribute
I'm having a hard time trying to find out why a test is failing: describe User, "Instance Methods" do describe "leave_group!" do it "should set group_id to nil" do @user = Factory(:user) @group_2 = Factory(:group, :owner => @user) @user.leave_group! @user.reload.group_id.should be_nil # THIS LINE IS FAILING!!! end it "should assign another owner to group, if owner was user" do @user = Factory(:user) @group = Factory(:group, :owner => @user) 1.upto(4) { @group.add_user Factory(:user) } @user.leave_group! @group.reload.owner.should_not eql(@user) end end end These are the models I'm using: class