If I want to reload an AR association, I can call "reload" on it. department.employees.reload or what have you. But what I want to do is uncache it, but not actually take a trip to the db. I want to mark it so NEXT time it's accessed, it will take a trip to the db (if it is ever accessed again). I know it's become unreliable, but I don't want to spend the time reloading it now, I want to just mark it as uncached. Lazily reload it. Any good way to do that in AR?
on 07.05.2008 22:25
on 07.05.2008 23:01
On 7 May 2008, at 21:25, Jonathan Rochkind wrote: > mark > it as uncached. Lazily reload it. > If it's an association collection, then department.employees.reset should do the trick. For has_one/belongs_to you need to fiddle with innards. Fred
on 07.05.2008 23:05
Perfect, that meets my present needs, thanks. Would be a useful enhancement to support reset/reload on to-one relationships too, but for now this is what I need, thanks. Frederick Cheung wrote: > On 7 May 2008, at 21:25, Jonathan Rochkind wrote: > >> mark >> it as uncached. Lazily reload it. >> > > If it's an association collection, then department.employees.reset > should do the trick. For has_one/belongs_to you need to fiddle with > innards. > > Fred