aboutsummaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-21 23:02:15 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-21 23:02:15 +0100
commit7ae6a547c0bd87aa884080dc239e6392051d50f6 (patch)
treedb761c4ecf242250bc44f8634f7e5829e3ac7fd9 /app/models
parent63b495dfef8249e173fc26df0010b5ba8d6143a7 (diff)
downloadgovuk-mini-environment-admin-7ae6a547c0bd87aa884080dc239e6392051d50f6.tar
govuk-mini-environment-admin-7ae6a547c0bd87aa884080dc239e6392051d50f6.tar.gz
Replace the has_many terraform_states with a method
As the has_many didn't work, as the key is not what Rails expects.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/mini_environment.rb5
1 files changed, 4 insertions, 1 deletions
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