Polymorphic Not Updating after deleting join

Using the example in the docs if I say

@folder.items

and I list the items, everything lists fine. If I delete a ‘linking’, I
still get the same list. Shouldn’t I get one less item even though the
other two db’s haven’t been updated?

ScuzzleButt wrote:

Using the example in the docs if I say

@folder.items

and I list the items, everything lists fine. If I delete a ‘linking’, I
still get the same list. Shouldn’t I get one less item even though the
other two db’s haven’t been updated?

If you delete a join model record, you have to reset or reload the
:items" has_many :through association for it to notice the change. You
can say @folder.items(true) to return the reloaded list, or
@folder.items.reset to just clear the in-memory cache of items.


Josh S.
http://blog.hasmanythrough.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs