]> projects.mako.cc - selectricity-live/blobdiff - app/views/quickvote/list_voters.rhtml
Added a link to open elections off the election's 'show' page
[selectricity-live] / app / views / quickvote / list_voters.rhtml
index 4d8e5388aae7b0f674b1be991e5b5662788b0e05..b0dc6dd96768b6662768d25bb3fad0bc17e29654 100644 (file)
@@ -27,8 +27,8 @@
             voter.ipaddress =~ /^172\.[1-3]/
             %>
             <% w=nil
-            if Cache and w=Cache.get("WHOIS:#{voter.ipaddress}")
-            elsif Cache
+            if defined? Cache and w=Cache.get("WHOIS:#{voter.ipaddress}")
+            elsif defined? Cache
               w= Whois::Whois.new(IPAddr.new(voter.ipaddress),true)
               w.search_whois
               Cache.set("WHOIS:#{voter.ipaddress}", w)
@@ -38,7 +38,7 @@
             end
             
             %>
-        <%=h((w.host == nil or w.host.empty?) ? voter.ipaddress : w.host[-30..-1])%>
+        <%=h((w.host == nil or w.host.empty?) ? voter.ipaddress : w.host.reverse.slice(0,30).reverse)%>
       </td>
       <td>
         <%org=(w.all.grep(/^(OrgName|org-name)/)[0] or "").sub(/^(OrgName|org-name)\:/,'').strip+" - "+ (w.all.grep(/^(NetName|netname)/)[0] or "").sub(/^(NetName|netname)\:/,'').strip %>

Benjamin Mako Hill || Want to submit a patch?