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
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
...
@@ -7,11 +7,11 @@ module RedisCacheable
class_methods
do
class_methods
do
def
cached_attr_reader
(
*
attributes
)
def
cached_attr_reader
(
*
attributes
)
attributes
.
each
do
|
attribute
|
attributes
.
each
do
|
attribute
|
unless
self
.
column_names
.
include?
(
attribute
.
to_s
)
define_method
(
attribute
)
do
raise
ArgumentError
,
"`cached_attr_reader` requires the
#{
self
.
name
}
#
#{
attribute
}
to be a database attribute"
unless
self
.
has_attribute?
(
attribute
)
raise
ArgumentError
,
"`cached_attr_reader` requires the
#{
self
.
class
.
name
}
\#
#{
attribute
}
attribute to have a database column"
end
end
define_method
(
attribute
)
do
cached_attribute
(
attribute
)
||
read_attribute
(
attribute
)
cached_attribute
(
attribute
)
||
read_attribute
(
attribute
)
end
end
end
end
...
@@ -50,9 +50,7 @@ module RedisCacheable
...
@@ -50,9 +50,7 @@ module RedisCacheable
if
Gitlab
.
rails5?
if
Gitlab
.
rails5?
self
.
class
.
type_for_attribute
(
attribute
).
cast
(
value
)
self
.
class
.
type_for_attribute
(
attribute
).
cast
(
value
)
else
else
ActiveSupport
::
Deprecation
.
silence
do
self
.
class
.
column_for_attribute
(
attribute
).
type_cast_from_database
(
value
)
self
.
class
.
column_for_attribute
(
attribute
).
type_cast_from_database
(
value
)
end
end
end
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