I'm having array where values could be only 1
or 0
.
array_example = [0, 0, 0, 0, 1]
As you can see there is already 1
in the array, so i need to forbid the case when there could be 2 or more elements with value 1
.
Just as example, in array should be only 1 element with value 1
, so if array will be like this, i should get an error.
array_example = [1, 0, 0, 0, 1]
Ruby 1.8.7
Rails 2.3.4