[Locomotive-users] Problem with :belongs_to relation

Stephen Waits steve at waits.net
Mon Feb 26 19:40:12 GMT 2007


Samuel Linde wrote:
> 
>>   b.customer?
> 
> This method returns the following:
> ArgumentError: wrong number of arguments (0 for 1)

Whoops..  the customer? method is actually equivalent to b.customer == 
some_other_customer..  I told you to use it wrong.  My bad..

So does this work ok?

   Booking.find(:all).each { |b| puts b.customer.company_name unless 
b.customer.nil? }

How about this?

   nil_bookings = Booking.find(:all).select { |b| b.customer.nil? }
   nil_bookings.size

I suspect things are working Ok on the Rails end of the world for you.

--Steve



More information about the Locomotive-users mailing list