summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-05-17 11:57:23 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-05-17 11:57:23 +0200
commita63ada5e77c4d817b05552d066dc6004003aaf98 (patch)
tree9cbb8ff26f3c06baf1f39b837d1c4d8491466b11
parent51f5ee33c448ee8a157ad12dac80482a11a7c72f (diff)
downloadgitlab-ce-a63ada5e77c4d817b05552d066dc6004003aaf98.tar.gz
Include class name and argument name in argument error
-rw-r--r--app/models/concerns/redis_cacheable.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/concerns/redis_cacheable.rb b/app/models/concerns/redis_cacheable.rb
index 3d24f0dfdc1..b5425295130 100644
--- a/app/models/concerns/redis_cacheable.rb
+++ b/app/models/concerns/redis_cacheable.rb
@@ -8,7 +8,9 @@ module RedisCacheable
def cached_attr_reader(*attributes)
attributes.each do |attribute|
define_method(attribute) do
- raise ArgumentError, "Not a database attribute" unless self.has_attribute?(attribute)
+ unless self.has_attribute?(attribute)
+ raise ArgumentError, "`cached_attr_reader` requires the #{self.class.name}\##{attribute} attribute to have a database column"
+ end
cached_attribute(attribute) || read_attribute(attribute)
end