Skip to content

Commit 797b5d0

Browse files
committed
Convert #find_or_create_by_x to #where().first_or_create
MSP-12016
1 parent dda8766 commit 797b5d0

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)