diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-02 17:31:25 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-02 17:31:25 +0300 |
commit | 30938b898c5415d8ec5cdf6c9851c45c1464c1a0 (patch) | |
tree | 39414abe26bb1eff4fea56cbff2a4eb356d03474 /app/controllers/projects/clusters | |
parent | 64be8d70ae20928df351e495a3442bb6036bc3e7 (diff) |
Fix and add applications controller
Diffstat (limited to 'app/controllers/projects/clusters')
-rw-r--r-- | app/controllers/projects/clusters/applications_controller.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/controllers/projects/clusters/applications_controller.rb b/app/controllers/projects/clusters/applications_controller.rb index 438e1853435..cdebbdefb3f 100644 --- a/app/controllers/projects/clusters/applications_controller.rb +++ b/app/controllers/projects/clusters/applications_controller.rb @@ -4,18 +4,14 @@ class Projects::Clusters::ApplicationsController < Projects::ApplicationControll before_action :authorize_read_cluster! before_action :authorize_create_cluster!, only: [:create] - def new - end - def create return render_404 if application - new_application = application_class.create(cluster: cluster) - respond_to do |format| format.json do - if new_application.persisted? - head :ok + # TODO: Do that via Service + if application_class.create(cluster: cluster).persisted? + head :no_data else head :bad_request end @@ -26,11 +22,11 @@ class Projects::Clusters::ApplicationsController < Projects::ApplicationControll private def cluster - @cluster ||= project.clusters.find_by(cluster_id: params[:cluster_id]).present(current_user: current_user) + @cluster ||= project.clusters.find(params[:id]) || render_404 end def application_class - Clusters::Cluster::Applications.find(params[:application]) + Clusters::Cluster::APPLICATIONS[params[:application]] || render_404 end def application |