summaryrefslogtreecommitdiff
path: root/app/models/concerns/has_environment_scope.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/has_environment_scope.rb')
-rw-r--r--app/models/concerns/has_environment_scope.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/concerns/has_environment_scope.rb b/app/models/concerns/has_environment_scope.rb
index 9553abe4dd3..c01996c0c4c 100644
--- a/app/models/concerns/has_environment_scope.rb
+++ b/app/models/concerns/has_environment_scope.rb
@@ -70,6 +70,14 @@ module HasEnvironmentScope
relation
end
+
+ scope :for_environment, ->(environment) do
+ if environment
+ on_environment(environment)
+ else
+ where(environment_scope: '*')
+ end
+ end
end
def environment_scope=(new_environment_scope)