2012-02-23 3 views
0

뷰에서 두 번째 도우미 함수를 실행하려고합니다. 첫 번째 호출을 반환하고 두 번째 호출을 호출합니다.스트림의 여러 JSON 객체

- hash = helper_method0 params[:some_string] #does a request on a third party site which responds with json data wich is then parsed by yajl and the hash is returned to view 
%p= helper_method1 hash #Literally is just returning the input parameter 

내가

Found multiple JSON objects in the stream but no block or the on_parse_complete callback was assigned to handle them. 

어떻게 내가 전화 할 다음과 같은 오류 메시지가 나타납니다 그러나 나는 다음과 같은 호출 할 때

%p = helper_method0 params[:some_string] #does a request on a third party site which responds with json data wich is then parsed by yajl and the hash is returned to view 

: 내가 제대로 원하는 해시 반환하는 다음과 같은 기능을 알고 메서드에서보기에서 다른 메서드의 반환 값으로 입력 매개 변수를 사용합니까? 뭐

답변

2

: 완벽하게 정확한지 그리고 당신은 할 수 :
을 (당신이 바이트 변수를 저장하려는 경우)

%p= helper_method1(helper_method0 params[:some_string]) 

그러나 어쨌든. ..
이 오류는 json 파서의 문제와 같습니다 ... Yajl을 사용하고 있습니까?

다음과 같이 Yajl를 사용할 때이 문제를 보았다

: 나를 위해 일한 무엇

parser = Yajl::Parser.new 
hash = parser.parse(some_string) 

이 같은 Yajl 클래스의 방법을 사용 하였다는 :

Yajl::Parser.parse(some_string.strip) 

난이 도움이 되었으면 좋겠 :)