Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
eeb955a6
Commit
eeb955a6
authored
May 16, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Move argument check to cached getter definition class method"
This reverts commit
4e1bb1d1
.
parent
4e1bb1d1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/concerns/redis_cacheable.rb
app/models/concerns/redis_cacheable.rb
+2
-2
spec/models/concerns/redis_cacheable_spec.rb
spec/models/concerns/redis_cacheable_spec.rb
+2
-2
No files found.
app/models/concerns/redis_cacheable.rb
View file @
eeb955a6
...
...
@@ -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
...
...
spec/models/concerns/redis_cacheable_spec.rb
View file @
eeb955a6
...
...
@@ -11,8 +11,8 @@ describe RedisCacheable do
cached_value
end
def
self
.
attribute_names
%w[name time]
def
has_attribute?
(
attribute
)
attributes
.
has_key?
(
attribute
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment