문제

I'm trying to access a hash with all the values for each connection. Right now, it's connections.values[1] in order to bypass _total.

enter image description here

There are certain cases when _total doesn't show up for certain ppl, thus rendering the code above invalid.

I also tried connections.values by that spits out the value 450 instead off the actual connections. How do I make sure to ignore _total : 450 in cases that it does appear and just access the persons information instead?

도움이 되었습니까?

해결책

I think the problem lies in that the key name is "values" hash.values actually returns the values of a hash and that's an internal Ruby hash method.

Try using connections[:values] instead.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top