From 2e97d9f957eff4ba66f1c4c65ff0b5156471cf6c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 7 Apr 2018 15:27:38 +0100 Subject: Change mini_environment_id to state_id on TerraformState To allow supporting tracking related TerraformStates for backends as well. --- app/controllers/terraform_http_backend_controller.rb | 10 +++++----- app/models/terraform_state.rb | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/controllers/terraform_http_backend_controller.rb b/app/controllers/terraform_http_backend_controller.rb index ceff807..e4d8c54 100644 --- a/app/controllers/terraform_http_backend_controller.rb +++ b/app/controllers/terraform_http_backend_controller.rb @@ -23,7 +23,7 @@ class TerraformHttpBackendController < ApplicationController def create TerraformState.create( - mini_environment_id: mini_environment_id, + state_id: state_id, data: params ) @@ -32,7 +32,7 @@ class TerraformHttpBackendController < ApplicationController def show state = TerraformState.where( - mini_environment_id: mini_environment_id + state_id: state_id ).last if state.nil? @@ -44,13 +44,13 @@ class TerraformHttpBackendController < ApplicationController def destroy TerraformState - .where(mini_environment_id: mini_environment_id) + .where(state_id: state_id) .delete_all render json: '{ "success": true }', status: 200 end - def mini_environment_id - params[:mini_environment_id] + def state_id + params[:state_id] end end diff --git a/app/models/terraform_state.rb b/app/models/terraform_state.rb index fb2863f..2ea7c91 100644 --- a/app/models/terraform_state.rb +++ b/app/models/terraform_state.rb @@ -22,11 +22,11 @@ # # Table name: terraform_states # -# id :integer not null, primary key -# data :json -# created_at :datetime not null -# updated_at :datetime not null -# mini_environment_id :integer +# id :integer not null, primary key +# data :json +# created_at :datetime not null +# updated_at :datetime not null +# state_id :string default(""), not null # class TerraformState < ApplicationRecord -- cgit v1.2.3