Commit a63ada5e authored by Matija Čupić's avatar Matija Čupić

Include class name and argument name in argument error

parent 51f5ee33
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment