I'm trying to build a form that shows an order (from the orders table) and all of its line items (from the order_items table). I've defined the models like this: class OrderItem < ActiveRecord::Base belongs_to :order end class Order < ActiveRecord::Base has_many :order_items end The problem is that the order object doesn't have any order items associated with it when I get to the edit form. I thought this association was "automatic" based on the models. (no?) I've tried <% @order.order_items.each do |item| %> <tr><td><%= item.item_id %></td></tr> <% end %> But this does not show anythingl. I added a "debug(Order)" line on the form and I don't see any "order_items" in the object. Richard
on 2005-11-13 16:11
on 2005-11-13 18:53
Are there any order items associated with the order in the order_items db table?