add judge of nil value for ports and networkids

This commit is contained in:
nigel007 2019-06-11 09:00:01 +08:00
parent f4cff59064
commit 68a975d30a
1 changed files with 2 additions and 2 deletions

View File

@ -24,8 +24,8 @@ class BlockchainsService
ports = []
bcs = Blockchain.find_by_sql("select network_id, port from blockchains where user_id=#{user.id}")
bcs.each do |bc|
network_ids << bc.network_id
ports << bc.port
network_ids << bc.network_id unless network_id == nil
ports << bc.port unless port == nil
end
Rails.logger.info(network_ids)
Rails.logger.info(ports)