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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
55e2ce76
Commit
55e2ce76
authored
May 18, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Improve cacheable module"
This reverts commit
2ebafdfb
parent
2ebafdfb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
app/models/concerns/redis_cacheable.rb
app/models/concerns/redis_cacheable.rb
+5
-7
No files found.
app/models/concerns/redis_cacheable.rb
View file @
55e2ce76
...
...
@@ -7,11 +7,11 @@ module RedisCacheable
class_methods
do
def
cached_attr_reader
(
*
attributes
)
attributes
.
each
do
|
attribute
|
unless
self
.
column_names
.
include?
(
attribute
.
to_s
)
raise
ArgumentError
,
"`cached_attr_reader` requires the
#{
self
.
name
}
#
#{
attribute
}
to be a database attribute"
define_method
(
attribute
)
do
unless
self
.
has_attribute?
(
attribute
)
raise
ArgumentError
,
"`cached_attr_reader` requires the
#{
self
.
class
.
name
}
\#
#{
attribute
}
attribute to have a database column"
end
define_method
(
attribute
)
do
cached_attribute
(
attribute
)
||
read_attribute
(
attribute
)
end
end
...
...
@@ -50,9 +50,7 @@ module RedisCacheable
if
Gitlab
.
rails5?
self
.
class
.
type_for_attribute
(
attribute
).
cast
(
value
)
else
ActiveSupport
::
Deprecation
.
silence
do
self
.
class
.
column_for_attribute
(
attribute
).
type_cast_from_database
(
value
)
end
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