Skip to content

Commit 531743e

Browse files
committed
Land rapid7#4697, updates to finder syntax
Updates some Rails 3 style ActiveRecord calls to use the Rails 4 Arel syntax, in preparation for our move to Rails 4. Fixes rapid7#4697, also see MSP-12016
2 parents 036cb77 + 797b5d0 commit 531743e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/msf/core/db_manager/vuln.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def report_vuln(opts)
168168
sname = opts[:proto]
169169
end
170170

171-
service = host.services.find_or_create_by_port_and_proto(opts[:port].to_i, proto)
171+
service = host.services.where(port: opts[:port].to_i, proto: proto).first_or_create
172172
end
173173

174174
# Try to find an existing vulnerability with the same service & references

lib/msf/core/db_manager/workspace.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Msf::DBManager::Workspace
44
#
55
def add_workspace(name)
66
::ActiveRecord::Base.connection_pool.with_connection {
7-
::Mdm::Workspace.find_or_create_by_name(name)
7+
::Mdm::Workspace.where(name: name).first_or_create
88
}
99
end
1010

0 commit comments

Comments
 (0)