diff --git a/lib/bouncer/outcome/global_type.rb b/lib/bouncer/outcome/global_type.rb index 8051f88c..33112381 100644 --- a/lib/bouncer/outcome/global_type.rb +++ b/lib/bouncer/outcome/global_type.rb @@ -14,7 +14,7 @@ def serve when "archive" [410, { "Content-Type" => "text/html" }, [renderer.render(context.attributes_for_render, 410)]] else - message = "Can't serve unexpected global_type: #{context.site.global_type} for #{context.site.abbr}" + message = "Can't serve unexpected global_type: #{context.site.global_type} for #{context.site.default_hostname}" [500, { "Content-Type" => "text/plain" }, [message]] end end diff --git a/lib/site.rb b/lib/site.rb index 4a5bcdc7..e2ab5927 100644 --- a/lib/site.rb +++ b/lib/site.rb @@ -6,4 +6,8 @@ class Site < ActiveRecord::Base belongs_to :organisation has_many :hosts has_many :mappings + + def default_hostname + @default_hostname ||= hosts.where(canonical_host_id: nil).order(:id).first.hostname + end end