I want to be able to manage has_many caching myself. The issue being I want to be able to archive (like soft delete, but with discardable gem) some records:
has_many :tags
def tag_list=(tag_names)
# so I do a diff
names_to_create = ...
tags_to_discard = ...
tags_to_keep = ...
to_delete.each(&:discard)
new_tags = names_to_create.each { |name| tag.create!(name: name) }
# if I just go with regular
self.tags = new_tags + tags_to_keep
# tags_to_discard will be deleted
The thing is that I don't want to just tags.reload
. It's costly
I know exactly what tags should be here or not.
How I can just "force" the rails cache?