1
해시 배열을 루비 다른 해시를 추가 할 수 없습니다가 나는 mongoid 객체를 가지고
개체@tran
이
@tran[:translations]
및 result
에서 해시의 배열을 가지고
@tran = Translations.where({:_id => params[:id]})[0]
내가 노력
다른 해시 가산기 result
~ @tran[:translations]
@tran[:translations] << result
@tran[:translations]
의 값은 [{*current value of result*}]
으로 변경되고 추가되지 않습니다.
여기에 근본적으로 잘못된 것이 있습니까? 내가 뭔가 잘 작동
@tran[:translations] = @tran[:translations] + [result]
대신
@tran[:translations] << result
'p @tran [: translations]'를 보여줄 수 있습니까? –
'@tran [: translations'의 값은''{{ "value": "hello3", "rating": 100, "rated": 0}]' –
내 irb에서 검사했는데 이상한 점은 없었습니다. 당신은 .. –