From 7ae6a547c0bd87aa884080dc239e6392051d50f6 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 21 Jun 2018 23:02:15 +0100 Subject: Replace the has_many terraform_states with a method As the has_many didn't work, as the key is not what Rails expects. --- app/models/mini_environment.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/mini_environment.rb b/app/models/mini_environment.rb index c92a62c..502cff2 100644 --- a/app/models/mini_environment.rb +++ b/app/models/mini_environment.rb @@ -45,7 +45,6 @@ class MiniEnvironment < ApplicationRecord end, dependent: :destroy ) - has_many :terraform_states, dependent: :destroy belongs_to :govuk_guix_revision, class_name: 'GovukGuix::Revision' belongs_to :backend, polymorphic: true @@ -71,6 +70,10 @@ class MiniEnvironment < ApplicationRecord end end + def terraform_states + backend.terraform_states(self) + end + def signon_users_attributes=(attributes) self.signon_users = attributes.sort.map(&:last) end -- cgit v1.2.3