summaryrefslogtreecommitdiff
path: root/app/models/intruder.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-16 11:10:02 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-16 11:10:02 +0100
commit5d8ce5f4775ac8bc5f523964e6e36f63ff3c4683 (patch)
tree49ed889b1d10cda98c475f3453abff1b97afb4e7 /app/models/intruder.rb
parentc9066760fd1f5f2f892ce2be5cf2a83bb5210246 (diff)
parent55784bcffc0678ce6102c0b81447434a8030ebd2 (diff)
Merge branch 'develop'5.1-beta5
Diffstat (limited to 'app/models/intruder.rb')
-rw-r--r--app/models/intruder.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index db14bf8..249fffc 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -17,11 +17,14 @@ class Intruder < ActiveRecord::Base
before_validation :set_key_if_empty
+ def to_s
+ key
+ end
- def whois
- if ! self.contact_ip.blank?
+ def whois(ip_address = self.contact_ip)
+ if ! ip_address.blank?
begin
- return Whois.whois(self.contact_ip)
+ return Whois.whois(ip_address).to_s.gsub(/[^\u{0000}-\u{007F}]/, '')
rescue
return nil
end