Andrei
2006-Apr-28 09:42 UTC
[Rails] ActiveRecord associations -- when to use force_reload = true
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 -- Posted via http://www.ruby-forum.com/.