2012-02-23 9 views
0

私はビューの2つのヘルパー関数を実行しようとしています。私は呼んではどうすればよいストリーム内の複数の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) 

私はこのことができます:)

を願っています
関連する問題