Unequal Object Identities in Rails

They're different ruby objects. But you should be able to do: @order
== @line_item.order, since that checks the #id of both records.

In your LineItem class, you'll have to save the order to the database
and reload any instances you have in memory to see the changes

Seems wasteful to me too.

Proper ORM identity systems are tough to get right, and just not a big
deal 90% of the time. Consider this situation:

o1 = Order.find 1
o2 = Order.find 1, :include => :line_items

Two "equal" orders, but very different because one has the line_items

In your case you can do this:

o = Order.find(:first, :include => {:line_items => :order})

But, that generates an SQL query of WTF proportions.

I wrote about this in more depth on my blog, going into the query
caching stuff in Edge Rails, and an active_record_context plugin I
wrote. They're both very simple implementations of an identity system
that help out in most of the common cases: