BigW Consortium Gitlab

Commit 45e9d287 by http://jneen.net/

avoid #respond_to? in Cache.id_for

parent e515aa54
...@@ -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
nil
end end
id || "##{obj.object_id}"
end end
end end
end 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