Properly match against class

Turns out I was wrong 😅
This commit is contained in:
Maciej Szlosarczyk 2020-05-14 15:26:33 +03:00
parent 26858a7e8f
commit 960e4084e3
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765

View file

@ -24,16 +24,9 @@ class RetainedDomains
end
def domain_to_json(domain)
# Smelly, but ActiveRecord objects are weird and do not respond
# to usual syntax:
# case a
# when Array then "foo"
# when Hash then "bar"
# else "baz"
# end
status = case domain.class.to_s
when 'ReservedDomain' then RESERVED
when 'BlockedDomain' then BLOCKED
status = case domain
when ReservedDomain then RESERVED
when BlockedDomain then BLOCKED
end
punycode = SimpleIDN.to_ascii(domain.name)