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
45e9d287
Commit
45e9d287
authored
Jul 17, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid #respond_to? in Cache.id_for
parent
e515aa54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
lib/declarative_policy/cache.rb
lib/declarative_policy/cache.rb
+8
-5
No files found.
lib/declarative_policy/cache.rb
View file @
45e9d287
...
@@ -21,11 +21,14 @@ module DeclarativePolicy
...
@@ -21,11 +21,14 @@ module DeclarativePolicy
private
private
def
id_for
(
obj
)
def
id_for
(
obj
)
if
obj
.
respond_to?
(
:id
)
&&
obj
.
id
id
=
obj
.
id
.
to_s
begin
else
obj
.
id
"#
#{
obj
.
object_id
}
"
rescue
NoMethodError
end
nil
end
id
||
"#
#{
obj
.
object_id
}
"
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