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

Properly cleaning up memoized values

parent 4f00a051
...@@ -44,7 +44,9 @@ module ResolvableDiscussion ...@@ -44,7 +44,9 @@ module ResolvableDiscussion
end end
def first_note def first_note
notes.first strong_memoize(:first_note) do
notes.first
end
end end
def first_note_to_resolve def first_note_to_resolve
...@@ -102,8 +104,8 @@ module ResolvableDiscussion ...@@ -102,8 +104,8 @@ module ResolvableDiscussion
# Set the notes array to the updated notes # Set the notes array to the updated notes
@notes = notes_relation.fresh.to_a # rubocop:disable Gitlab/ModuleWithInstanceVariables @notes = notes_relation.fresh.to_a # rubocop:disable Gitlab/ModuleWithInstanceVariables
self.class.memoized_values.each do |var| self.class.memoized_values.each do |name|
instance_variable_set(:"@#{var}", nil) clear_memoization(name)
end end
end 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