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 +6,9 @@ class Click < ActiveRecord::Base | ||
6 | ip = what_was_clicked.split('[ip: ')[1].split(']').first rescue nil | 6 | ip = what_was_clicked.split('[ip: ')[1].split(']').first rescue nil |
7 | end | 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 | def ip | 13 | def ip |
11 | ip = what_was_clicked.split('[ip: ')[1].split(']').first rescue nil | 14 | ip = what_was_clicked.split('[ip: ')[1].split(']').first rescue nil |
@@ -13,7 +16,7 @@ class Click < ActiveRecord::Base | @@ -13,7 +16,7 @@ class Click < ActiveRecord::Base | ||
13 | 16 | ||
14 | def to_html | 17 | def to_html |
15 | if ip | 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 | else | 20 | else |
18 | return what_was_clicked | 21 | return what_was_clicked |
19 | end | 22 | end |