diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-21 23:02:15 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-21 23:02:15 +0100 |
commit | 7ae6a547c0bd87aa884080dc239e6392051d50f6 (patch) | |
tree | db761c4ecf242250bc44f8634f7e5829e3ac7fd9 | |
parent | 63b495dfef8249e173fc26df0010b5ba8d6143a7 (diff) | |
download | govuk-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.
-rw-r--r-- | app/models/mini_environment.rb | 5 |
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 |