Forum: Ruby on Rails Reload page, model method goes missing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
96f5de71a8111ed44d251e869270fc03?d=identicon&s=25 Blake Miller (blakeage)
on 2007-02-14 14:54
I have this weird problem.  I have a belongs_to :order relationship on a
line_item model object.

In index.rhtml, I have:
<%= @line_item.order.Id %>

If I restart Webrick, the first time I load the index.rhtml page, the
page loads fine.  But when I refresh the page (by refreshing the
browser), all of a sudden I get a rails error stating that method
"order" missing for <LineItem:#02838...

All subsequent browser refreshes return the error, until I restart
Webrick.  Then it's the same thing, page loads without error the first
time, and all browser refreshes afterwards throw the error.

I know it's not a browser caching issue because the LineItem object id
in the error changes with each refresh.

It's as if Rails (or ActiveRecord) loses the model method after the
second request??

Any ideas?
This topic is locked and can not be replied to.