Skip to content

Commit 992df12

Browse files
author
RageLtMan
committed
Address ActiveRecord deprecation warning
AR will start to complain about eager loading in command_dispatcher /db.rb:519 because it references hosts as string without explicitly stating that the table is being referenced. Add a call .references in the AR call chain after the where clause to silence this abysmal warning.
1 parent f7dd326 commit 992df12

File tree

1 file changed

+1
-1
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+1
-1
lines changed

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def cmd_hosts(*args)
463463
if search_term
464464
next unless (
465465
host.attribute_names.any? { |a| host[a.intern].to_s.match(search_term) } ||
466-
!Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and hosts.address = ? and tags.name = ?", framework.db.workspace.id, host.address, search_term.source).order("tags.id DESC").empty?
466+
!Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and hosts.address = ? and tags.name = ?", framework.db.workspace.id, host.address, search_term.source).references(:hosts).order("tags.id DESC").empty?
467467
)
468468
end
469469

0 commit comments

Comments
 (0)