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 7 May 2008, at 21:25, Jonathan R. 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
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 C. wrote:
On 7 May 2008, at 21:25, Jonathan R. 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