summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-05-16 22:43:38 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-05-16 22:43:38 +0200
commiteeb955a66d2410d7117737ecd1b33b0cfe67327b (patch)
tree2d4e20014c2202348ba17639408c96e3ccc8c202 /app
parent4e1bb1d1014237df79db6b3cc2beb24228a4b228 (diff)
downloadgitlab-ce-eeb955a66d2410d7117737ecd1b33b0cfe67327b.tar.gz
Revert "Move argument check to cached getter definition class method"
This reverts commit 4e1bb1d1014237df79db6b3cc2beb24228a4b228.
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/redis_cacheable.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/concerns/redis_cacheable.rb b/app/models/concerns/redis_cacheable.rb
index bf046c0e333..a8d96f63d7a 100644
--- a/app/models/concerns/redis_cacheable.rb
+++ b/app/models/concerns/redis_cacheable.rb
@@ -7,9 +7,9 @@ module RedisCacheable
class_methods do
def cached_attr_reader(*attributes)
attributes.each do |attribute|
- raise ArgumentError, "Not a database attribute" unless self.attribute_names.include?(attribute.to_s)
-
define_method(attribute) do
+ raise ArgumentError, "Not a database attribute" unless self.has_attribute?(attribute)
+
cached_attribute(attribute) || read_attribute(attribute)
end
end