Forum: Ruby on Rails ActiveRecord associations -- when to use force_reload = true

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.
Andrei (Guest)
on 2006-04-28 13:42
If an Order has_many Items, when do I have to call order.items(true)
instead of just order.items to get the current list of items ?

In Rails 1.1 if I call some_item.destroy, the order.items list doesn't
get updated unless I call order.items(true) -- this does not happen in
Rails 1.0.
Also when I add items to an order the list may or may not get updated
depending on the Rails version and the way I'm adding items.

So I'm confused by these inconsistencies...

Can anyone give me an official answer as to when I should call
order.items(true) to get an updated list of items? I wouldn't want to
call it with force_reload = true every time as that would defeat the
caching optimization.

Many thanks,
This topic is locked and can not be replied to.