[Locomotive-users] Problem with :belongs_to relation

Samuel Linde samuel.linde at gmail.com
Mon Feb 26 15:37:13 GMT 2007


Hi,

I don't know if this is a problem that has to do with Locomotive,  
MySQL, or just myself, but I figured there might be someone on the  
list who knows what to do.

I've set up two models, Customer and Booking, with a has_many -  
belongs_to relationship.
I have a list view for my BookingsController which shows the  
customer's name for each booking record,
via booking.customer.name.

Here comes the weird part. The first time I call my list function in  
the BookingsController, the page loads fine and shows the customer's  
name correctly, but on subsequent browser reloads, I get a  
"NoMethodError", stating "undefined method `customer' for #<Booking: 
0x32514c8>". I have to kill my ruby process and restart the Rails app  
in Locomotive to make it work again. Only to break on subsequent  
reloads, of course.

Does anyone know where I should start looking?

Thanks in advance,

/Samuel Linde


More information about the Locomotive-users mailing list