From b1a5b4c6dfdcf00a365a7c779abc1655ec84099f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 15 Jul 2020 09:48:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 3 ++- app/views/managements/_user_agent_list.html.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 0f0b1252..8f6baa03 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -29,7 +29,8 @@ class ManagementsController < ApplicationController end def user_agents - @user_agents = UserAgent.where("user_agents.key is not null and is_delete = 0").order("created_at desc") + @user_agents = UserAgent.joins("JOIN users u ON u.login = user_agents.key") + .where("user_agents.key is not null and is_delete = 0").order("created_at desc") @agents_count = @user_agents.count limit = 20 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 diff --git a/app/views/managements/_user_agent_list.html.erb b/app/views/managements/_user_agent_list.html.erb index e386970c..286d0f6a 100644 --- a/app/views/managements/_user_agent_list.html.erb +++ b/app/views/managements/_user_agent_list.html.erb @@ -12,7 +12,7 @@
<% @user_agents.each do |ua| %> - <% user = User.find_by_login(ua.key) %> + <% user = User.find_by_login(ua.key) %> <% user_extension = user&.user_extensions %> <% school = user_extension&.school %>