Your problem is that guest.arrived is returning nil.
If
guestwas thenil, then you'd have an error on line 90 sayingNoMethodError: undefined method `departure=' for nil:NilClassIf
departureDatewasnilthen you'd get an error on line 91 sayingNoMethodError: undefined method `-' for nil:NilClassBesides that, the
to_ifunction used on the first line always returns a number -- even if you gotnilor""from somewere else,nil.to_iand"".to_iboth return zero.If the
guest.arriveddidn't exist, you'd also get aNoMethodError.
Ken Bloom
2010-08-05 15:02:06