summaryrefslogtreecommitdiff
path: root/app/models/concerns/protected_ref.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/protected_ref.rb')
-rw-r--r--app/models/concerns/protected_ref.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb
index af387c99f3d..26adb6cfc44 100644
--- a/app/models/concerns/protected_ref.rb
+++ b/app/models/concerns/protected_ref.rb
@@ -13,7 +13,7 @@ module ProtectedRef
end
def commit
- project.commit(self.name)
+ project.commit(name)
end
class_methods do
@@ -25,9 +25,9 @@ module ProtectedRef
# If we don't `protected_branch` or `protected_tag` would be empty and
# `project` cannot be delegated to it, which in turn would cause validations
# to fail.
- has_many :"#{type}_access_levels", inverse_of: self.model_name.singular
+ has_many :"#{type}_access_levels", inverse_of: model_name.singular
- validates :"#{type}_access_levels", length: { is: 1, message: "are restricted to a single instance per #{self.model_name.human}." }
+ validates :"#{type}_access_levels", length: {is: 1, message: "are restricted to a single instance per #{model_name.human}."}
accepts_nested_attributes_for :"#{type}_access_levels", allow_destroy: true
end
@@ -46,7 +46,7 @@ module ProtectedRef
end
def access_levels_for_ref(ref, action:, protected_refs: nil)
- self.matching(ref, protected_refs: protected_refs)
+ matching(ref, protected_refs: protected_refs)
.map(&:"#{action}_access_levels").flatten
end
@@ -57,13 +57,13 @@ module ProtectedRef
# This method optionally takes in a list of `protected_refs` to search
# through, to avoid calling out to the database.
def matching(ref_name, protected_refs: nil)
- (protected_refs || self.all).select { |protected_ref| protected_ref.matches?(ref_name) }
+ (protected_refs || all).select { |protected_ref| protected_ref.matches?(ref_name) }
end
end
private
def ref_matcher
- @ref_matcher ||= RefMatcher.new(self.name)
+ @ref_matcher ||= RefMatcher.new(name)
end
end