Forum: Ruby on Rails Model method disappear after first page request

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.
blakeage (Guest)
on 2007-02-14 18:40
(Received via mailing list)
I can't figure out why model methods disappear after the first page
request?  If I restart Webrick, I can load the page once, without
error, but refresh the page, and I keep getting method missing
errors.  My code is extremely simple:

class LineItem < ActiveRecord::Base
  belongs_to :order

class Order < ActiveRecord::Base
  has_many :line_items

--> index.rhtml
<%= %>

Error is like method "order" missing for <LineItem:#29932...

This is in development mode, Rails 1.2, Windows 2000, Webrick

Mark C. (Guest)
on 2007-02-14 18:49
(Received via mailing list)
What code do you have in your controller?

blakeage (Guest)
on 2007-02-14 19:09
(Received via mailing list)
Nothing, except for the scaffold_resource inserted code, like
respond_to html...

It's in the index action, and I'm using the REST architecture.  My
index.rhtml source is like:
<% for acc in @user.accounts %>
  <% for line_item in acc.line_items %>
    <%= %>
  <% end %>
<% end %>

Note: You can pull back the line items by account, as each LineItem
has an AccountID
This topic is locked and can not be replied to.