diff options
author | spag <spag@golwen.net> | 2013-02-12 17:02:21 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-02-12 17:02:21 +0100 |
commit | e7d1428b749024096b9a22b331d110bcf04f87d1 (patch) | |
tree | dda4d3586c4f3fe62dfefb1ee7ef6ed0a9b85ec2 /app | |
parent | 36d1a38594361dcd021c23ae9c5040a37d0918df (diff) |
filter non-ascii characters
Diffstat (limited to 'app')
-rw-r--r-- | app/models/intruder.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb index db14bf8..8877c4c 100644 --- a/app/models/intruder.rb +++ b/app/models/intruder.rb @@ -18,10 +18,10 @@ class Intruder < ActiveRecord::Base before_validation :set_key_if_empty - 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(/[^A-Za-z0-9\:\_\-\ \+\.\,\n]/, '') rescue return nil end |