diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-06-29 18:53:32 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-06-29 19:11:48 -0300 |
commit | 2446252cfd1f5a7d7329099e8d6371fcffa99971 (patch) | |
tree | 42a740e7fc2ec0b6afb358b549c229c8a2c0eaa1 /app/models/concerns/routable.rb | |
parent | 37011af0c08a9c22cf4df0fb5655a2f2eff1117d (diff) | |
download | gitlab-ce-2446252cfd1f5a7d7329099e8d6371fcffa99971.tar.gz |
Expires full_path cache after project is renamed
Diffstat (limited to 'app/models/concerns/routable.rb')
-rw-r--r-- | app/models/concerns/routable.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb index ec7796a9dbb..2305e01d3f1 100644 --- a/app/models/concerns/routable.rb +++ b/app/models/concerns/routable.rb @@ -103,8 +103,11 @@ module Routable def full_path return uncached_full_path unless RequestStore.active? - key = "routable/full_path/#{self.class.name}/#{self.id}" - RequestStore[key] ||= uncached_full_path + RequestStore[full_path_key] ||= uncached_full_path + end + + def expires_full_path_cache + RequestStore.delete(full_path_key) if RequestStore.active? end def build_full_path @@ -135,6 +138,10 @@ module Routable path_changed? || parent_changed? end + def full_path_key + @full_path_key ||= "routable/full_path/#{self.class.name}/#{self.id}" + end + def build_full_name if parent && name parent.human_name + ' / ' + name |