fixes issue with creating new organizations when there are no ip pools
This commit is contained in:
1 parent
10794f8573
commit
3ed9438a00
2 files changed
+4
-2
No files matched your search
@@ -48,7 +48,9 @@ class Organization < ApplicationRecord
|
|||||||
has_many :ip_pool_rules, :dependent => :destroy, :as => :owner
|
has_many :ip_pool_rules, :dependent => :destroy, :as => :owner
|
||||||
|
|
||||||
after_create do
|
after_create do
|
||||||
self.ip_pools << IPPool.transactional.default
|
if pool = IPPool.transactional.default
|
||||||
|
self.ip_pools << IPPool.transactional.default
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def status
|
def status
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@ user = User.create!(:first_name => "Example", :last_name => "Admin", :email_addr
|
|||||||
org = Organization.create!(:name => "Acme Inc", :permalink => "acme", :time_zone => "London", :owner => user)
|
org = Organization.create!(:name => "Acme Inc", :permalink => "acme", :time_zone => "London", :owner => user)
|
||||||
org.users << user
|
org.users << user
|
||||||
|
|
||||||
server = Server.create!(:ip_pool => ip_pool, :organization => org, :name => "Example Server", :permalink => "example", :mode => "Live")
|
server = Server.create!(:organization => org, :name => "Example Server", :permalink => "example", :mode => "Live")
|
||||||
Reference in new issue
Block a user