From 440c5219bd9d6928eeaf991f2f3b0448c464f3f3 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 1 May 2017 15:50:39 -0700 Subject: [PATCH] memoize domains --- app/models/artist.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/artist.rb b/app/models/artist.rb index 228b54946..c457bde3a 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -1,4 +1,5 @@ class Artist < ActiveRecord::Base + extend Memoist class RevertError < Exception ; end before_create :initialize_creator @@ -52,6 +53,10 @@ class Artist < ActiveRecord::Base end end + included do + memoize :domains + end + def url_array urls.map(&:url) end @@ -250,6 +255,8 @@ class Artist < ActiveRecord::Base end def reload(options = nil) + flush_cache + if instance_variable_defined?(:@notes) remove_instance_variable(:@notes) end