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
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-05-17 12:57:23 +0300
committerMatija Čupić <matteeyah@gmail.com>2018-05-17 12:57:23 +0300
commita63ada5e77c4d817b05552d066dc6004003aaf98 (patch)
tree9cbb8ff26f3c06baf1f39b837d1c4d8491466b11 /app/models/concerns/redis_cacheable.rb
parent51f5ee33c448ee8a157ad12dac80482a11a7c72f (diff)
Include class name and argument name in argument error
Diffstat (limited to 'app/models/concerns/redis_cacheable.rb')
-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