From dc1eab377cba313dcfbe498ddc8ed6200488aad7 Mon Sep 17 00:00:00 2001 From: Sonny Gonzalez Date: Fri, 13 Feb 2015 12:39:44 -0600 Subject: [PATCH] Rails 4 finder conversion: convert find_or_initialize_by_x_and_y MSP-12153 * convert to where(conditions).first_or_initialize --- lib/msf/core/db_manager/host.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/db_manager/host.rb b/lib/msf/core/db_manager/host.rb index b4ff90063f..26dae7a27a 100644 --- a/lib/msf/core/db_manager/host.rb +++ b/lib/msf/core/db_manager/host.rb @@ -166,9 +166,9 @@ module Msf::DBManager::Host end if opts[:comm] and opts[:comm].length > 0 - host = wspace.hosts.find_or_initialize_by_address_and_comm(addr, opts[:comm]) + host = wspace.hosts.where(address: addr, comm: opts[:comm]).first_or_initialize else - host = wspace.hosts.find_or_initialize_by_address(addr) + host = wspace.hosts.where(address: addr).first_or_initialize end else host = addr @@ -257,9 +257,9 @@ module Msf::DBManager::Host end if opts[:comm] and opts[:comm].length > 0 - host = wspace.hosts.find_or_initialize_by_address_and_comm(addr, opts[:comm]) + host = wspace.hosts.where(address: addr, comm: opts[:comm]).first_or_initialize else - host = wspace.hosts.find_or_initialize_by_address(addr) + host = wspace.hosts.where(address: addr).first_or_initialize end else host = addr