Commit 9e7eb87c authored by Kamil Trzciński's avatar Kamil Trzciński

Enforce validation

parent e41465c6
......@@ -50,14 +50,14 @@ class PrometheusAlert < ActiveRecord::Base
end
def require_valid_environment_project!
return if project == environment.project
return if project == environment&.project
errors.add(:environment, "invalid project")
end
def require_valid_metric_project!
return if prometheus_metric.default?
return if project == prometheus_metric.project
return if prometheus_metric&.common?
return if project == prometheus_metric&.project
errors.add(:prometheus_metric, "invalid project")
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