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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4867fbf606e2dcb99423b178f6c59ab6?d=identicon&s=25 Andrei (Guest)
on 2006-04-28 11: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,
Andrei
This topic is locked and can not be replied to.