summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/intruder.rb11
-rw-r--r--app/views/intruders/show.html.haml5
2 files changed, 15 insertions, 1 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?
diff --git a/app/views/intruders/show.html.haml b/app/views/intruders/show.html.haml
index fa5f59b..4941e89 100644
--- a/app/views/intruders/show.html.haml
+++ b/app/views/intruders/show.html.haml
@@ -46,4 +46,7 @@
%strong= t('intruders.show.comment') + ":"
= @intruder.comment
-= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @intruder } \ No newline at end of file
+%p
+ %pre= @intruder.whois
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @intruder }