Commit 82782873 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Properly cleaning up memoized values

parent c3fa3e05
......@@ -44,7 +44,9 @@ module ResolvableDiscussion
end
def first_note
notes.first
strong_memoize(:first_note) do
notes.first
end
end
def first_note_to_resolve
......@@ -102,8 +104,8 @@ module ResolvableDiscussion
# Set the notes array to the updated notes
@notes = notes_relation.fresh.to_a # rubocop:disable Gitlab/ModuleWithInstanceVariables
self.class.memoized_values.each do |var|
instance_variable_set(:"@#{var}", nil)
self.class.memoized_values.each do |name|
clear_memoization(name)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment