For example we have model TableRow - columns (:account_number, :month, :department, :phone_number). And have a method that returns filtered rows by arrays of this params. For required params we can use
TableRow.where('account_number IN (?)', param) Is there best way to add in this query unrequired params (department, phone_number) that can be nill and we should return records with any params in this column?