Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-01-10 13:09:00 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-01-12 12:54:55 +0300
commita93ccf07107c1680b19c16c3365ee6a94f450811 (patch)
tree1ff5c7b22d472cd553efd73056a801e81934ead2 /app
parent4f00a05152c105814f17a5f582d493435de96747 (diff)
Properly cleaning up memoized values
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/resolvable_discussion.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/concerns/resolvable_discussion.rb b/app/models/concerns/resolvable_discussion.rb
index 6a2cb80b6d5..7c236369793 100644
--- a/app/models/concerns/resolvable_discussion.rb
+++ b/app/models/concerns/resolvable_discussion.rb
@@ -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