Skip to content

Commit ce688f4

Browse files
committed
Land rapid7#4765, Rails4 compatible finder conversion
* find_or_initialize_by_DYNAMIC
2 parents f6bc693 + dc1eab3 commit ce688f4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/msf/core/db_manager/host.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ def report_host(opts)
166166
end
167167

168168
if opts[:comm] and opts[:comm].length > 0
169-
host = wspace.hosts.find_or_initialize_by_address_and_comm(addr, opts[:comm])
169+
host = wspace.hosts.where(address: addr, comm: opts[:comm]).first_or_initialize
170170
else
171-
host = wspace.hosts.find_or_initialize_by_address(addr)
171+
host = wspace.hosts.where(address: addr).first_or_initialize
172172
end
173173
else
174174
host = addr
@@ -257,9 +257,9 @@ def update_host_via_sysinfo(opts)
257257
end
258258

259259
if opts[:comm] and opts[:comm].length > 0
260-
host = wspace.hosts.find_or_initialize_by_address_and_comm(addr, opts[:comm])
260+
host = wspace.hosts.where(address: addr, comm: opts[:comm]).first_or_initialize
261261
else
262-
host = wspace.hosts.find_or_initialize_by_address(addr)
262+
host = wspace.hosts.where(address: addr).first_or_initialize
263263
end
264264
else
265265
host = addr

0 commit comments

Comments
 (0)