Skip to content

Commit f0bf881

Browse files
committed
Land rapid7#4720, update Rails 3-style .find(:first)
Eliminate the Rails 3-style .find(:first) calls, and replace with Rails 4-compatible .first(). Fixes rapid7#4720, also see MSP-12012
2 parents 9b10cd5 + 1051f0f commit f0bf881

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/msf/core/db_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def initialize(framework, opts = {})
130130
#
131131
def check
132132
::ActiveRecord::Base.connection_pool.with_connection {
133-
res = ::Mdm::Host.find(:first)
133+
res = ::Mdm::Host.first
134134
}
135135
end
136136

lib/msf/core/db_manager/vuln.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def find_vuln_by_details(details_map, host, service=nil)
3131
vuln = nil
3232

3333
if service
34-
vuln = service.vulns.find(:first, :include => [:vuln_details], :conditions => crit)
34+
vuln = service.vulns.includes(:vuln_details).where(:crit).first
3535
end
3636

3737
# Return if we matched based on service
3838
return vuln if vuln
3939

4040
# Prevent matches against other services
4141
crit["vulns.service_id"] = nil if service
42-
vuln = host.vulns.find(:first, :include => [:vuln_details], :conditions => crit)
42+
vuln = host.vulns.includes(:vuln_details).where(:crit).first
4343

4444
return vuln
4545
end

0 commit comments

Comments
 (0)