IpAddrSearch: fix pool_versions exception.

Fix pool_versions exception if PoolArchive db isn't set up. Prefer
ActiveRecord over raw sql so we can get real user objects so that the
view can use link_to_user.
This commit is contained in:
evazion
2017-01-12 05:32:04 +00:00
parent fde7829bf6
commit 4848f18455
3 changed files with 22 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
<p><%= link_to "Search for users with these IP addresses", moderator_ip_addrs_path(:search => {:ip_addr => @results.map {|k, count| k}.reject{|ip| ip == "127.0.0.1"}.join(",")}) %></p>
<p><%= link_to "Search for users with these IP addresses", moderator_ip_addrs_path(:search => {:ip_addr => @results.keys.reject{|ip| ip == "127.0.0.1"}.join(",")}) %></p>
<table class="striped">
<thead>

View File

@@ -1,4 +1,4 @@
<p><%= link_to "Search for IP addresses with these users", moderator_ip_addrs_path(:search => {:user_id => @results.map{|k, count| k}.join(",")}) %></p>
<p><%= link_to "Search for IP addresses with these users", moderator_ip_addrs_path(:search => {:user_id => @results.map{|user, count| user.id}.join(",")}) %></p>
<table class="striped">
<thead>
@@ -9,12 +9,12 @@
</tr>
</thead>
<tbody>
<% @results.each do |user_id, count| %>
<% @results.each do |user, count| %>
<tr>
<td><%= link_to User.id_to_name(user_id), user_path(user_id) %></td>
<td><%= link_to_user user %></td>
<td><%= count %></td>
<td><%= link_to "Show IP addresses", moderator_ip_addrs_path(:search => {:user_id => user_id}) %></td>
<td><%= link_to "Show IP addresses", moderator_ip_addrs_path(:search => {:user_id => user.id}) %></td>
</tr>
<% end %>
</tbody>
</table>
</table>