Commit 1a9cef79 authored by Matija Čupić's avatar Matija Čupić

Limit projects to just one cluster

parent cc0c6115
......@@ -5,6 +5,8 @@ module Clusters
def execute(access_token)
@access_token = access_token
return unless can_create_cluster?
create_cluster.tap do |cluster|
ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
end
......@@ -25,5 +27,13 @@ module Clusters
@cluster_params = params.merge(user: current_user, projects: [project])
end
def can_create_cluster?
if project.clusters.empty?
true
else
false
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