Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-08-30 15:33:39 +0300
committerSean McGivern <sean@gitlab.com>2017-08-30 16:32:02 +0300
commitb9d8946395ebe2b0d05e464e6a2af1181c7f1b90 (patch)
treea87957b03646fe6ac3a292a07269e3937dad574c /lib/api/helpers.rb
parent07a7801c03ec6f5bccd517c38beaec426c554e11 (diff)
Don't use public_send in destroy_conditionally! helper
As we only override in two places, we could just ask for the value rather than the method name.
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 84980864151..3d377fdb9eb 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -19,8 +19,10 @@ module API
end
end
- def destroy_conditionally!(resource, last_update_field: :updated_at)
- check_unmodified_since!(resource.public_send(last_update_field))
+ def destroy_conditionally!(resource, last_updated: nil)
+ last_updated ||= resource.updated_at
+
+ check_unmodified_since!(last_updated)
status 204
if block_given?