Skip to content

Instantly share code, notes, and snippets.

@etozzato
Created December 22, 2009 23:20
Show Gist options
  • Save etozzato/262165 to your computer and use it in GitHub Desktop.
Save etozzato/262165 to your computer and use it in GitHub Desktop.
def valid_dns?
return true if self.cname
begin
require 'resolv'
heroku = Resolv.getaddresses("proxy.heroku.com")
ip = Resolv.getaddress(self.landing.gsub('http://', ''))
update_attribute(:cname, true) if heroku.include?(ip)
return self.cname
rescue
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment