Commit d57097f537bd6fe7b2511410766fb246180d0232
1 parent
d93aa626
Exists in
master
and in
1 other branch
geoip link
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
app/models/click.rb
... | ... | @@ -6,6 +6,9 @@ class Click < ActiveRecord::Base |
6 | 6 | ip = what_was_clicked.split('[ip: ')[1].split(']').first rescue nil |
7 | 7 | end |
8 | 8 | |
9 | + def geoip_link | |
10 | + "<a href='http://api.hostip.info/get_html.php?ip=#{ip}'>#{ip}</a>" | |
11 | + end | |
9 | 12 | |
10 | 13 | def ip |
11 | 14 | ip = what_was_clicked.split('[ip: ')[1].split(']').first rescue nil |
... | ... | @@ -13,7 +16,7 @@ class Click < ActiveRecord::Base |
13 | 16 | |
14 | 17 | def to_html |
15 | 18 | if ip |
16 | - return what_was_clicked.gsub('ip', "<a href='http://api.hostip.info/get_html.php?ip=#{ip}'#{ip}</a>") | |
19 | + return what_was_clicked.gsub('ip', geoip_link) | |
17 | 20 | else |
18 | 21 | return what_was_clicked |
19 | 22 | end | ... | ... |