0
我不知道爲什麼這不是在rails中工作,但它在IRB中工作。設置一個現有的變量到自己的第一個元素
我做這樣的事情:
response = response.first
response
是哈希數組。
在irb中,當試圖模擬它時,它工作正常。
如:
如:
(rdb:1) response = response.first
NoMethodError Exception: undefined method `first' for nil:NilClass
(rdb:1) response
nil
然後
>> a = [{'a'=>3}]
=> [{"a"=>3}]
>> a = a.first
=> {"a"=>3}
然而,在調試模式下,黃瓜(在我的步驟定義),我做了上述語句時得到這個,response
設置爲nil
。
爲什麼行爲不同?
正確的金錢,:) ..我想通了和反應是一個方法在不同的文件中。 D'哦.. – volk