From ddf2a859bf405eb9dbef62cac86bf26075f6f2a9 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Sat, 29 Apr 2017 20:42:29 +0200 Subject: [PATCH] Fix removed ip_pool type errors (#62) * Fix undefined method description Sice `:description` was removed from the IP pools it should display the IP pool `:name` instead of the `:description`. * Fix using the removed ip_pool type --- app/models/server.rb | 2 +- app/views/servers/_form.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/server.rb b/app/models/server.rb index 4be4370..7d9721b 100644 --- a/app/models/server.rb +++ b/app/models/server.rb @@ -273,7 +273,7 @@ class Server < ApplicationRecord end def validate_ip_pool_belongs_to_organization - if self.ip_pool && self.ip_pool_id_changed? && (self.ip_pool.type == 'Dedicated' && !self.organization.ip_pools.include?(self.ip_pool)) + if self.ip_pool && self.ip_pool_id_changed? && !self.organization.ip_pools.include?(self.ip_pool) errors.add :ip_pool_id, "must belong to the organization" end end diff --git a/app/views/servers/_form.html.haml b/app/views/servers/_form.html.haml index 4b63e2d..511970f 100644 --- a/app/views/servers/_form.html.haml +++ b/app/views/servers/_form.html.haml @@ -25,7 +25,7 @@ .fieldSet__field = f.label :ip_pool_id, :class => 'fieldSet__label' .fieldSet__input - = f.collection_select :ip_pool_id, organization.ip_pools.includes(:ip_addresses).order("`default` desc, name asc"), :id, :description, {}, :class => 'input input--select' + = f.collection_select :ip_pool_id, organization.ip_pools.includes(:ip_addresses).order("`default` desc, name asc"), :id, :name, {}, :class => 'input input--select' %p.fieldSet__text This is the set of IP addresses which outbound e-mails will be delivered from.