diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/intruder.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb index c013ee8..db14bf8 100644 --- a/app/models/intruder.rb +++ b/app/models/intruder.rb @@ -17,6 +17,17 @@ class Intruder < ActiveRecord::Base before_validation :set_key_if_empty + + def whois + if ! self.contact_ip.blank? + begin + return Whois.whois(self.contact_ip) + rescue + return nil + end + end + end + private def set_key_if_empty if self.key.blank? |