From e201765f027d26548bbad208e8909a82da118ba4 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 1 Aug 2016 19:31:51 -0400 Subject: [PATCH] Update vehicles_controller.rb --- app/controllers/vehicles_controller.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/controllers/vehicles_controller.rb b/app/controllers/vehicles_controller.rb index 1ce7a99..e6daf19 100644 --- a/app/controllers/vehicles_controller.rb +++ b/app/controllers/vehicles_controller.rb @@ -91,5 +91,18 @@ class VehiclesController < ApplicationController render_404 end end + + private + + def only_one_non_zero?( array ) + found_non_zero = false + array.each do |val| + if val!=0 + return false if found_non_zero + found_non_zero = true + end + end + found_non_zero + end end