fbgraph:true:trueclass for true for true for trueの未定義の方法 `encode_json '
-
23-10-2019 - |
質問
私のコード:
def start
redirect_to client.authorization.authorize_url(:redirect_uri => callback_oauth_url,
:scope => "email,user_birthday,user_hometown,user_interests,user_location,user_notes,user_status,sms,publish_stream")
end
def callback
access_token = client.authorization.process_callback params[:code], :redirect_uri => callback_oauth_url
session[:access_token] = access_token
render :json => client.selection.me.info! # <-- HERE IS THE ERROR >.<
end
私は行きました /oauth/start/
サインインに成功し、アプリを許可しました。その後、Facebookは私をアプリにリダイレクトしました。これにより、このエラーが発生しました。
oauthcontrollerのnomethoderror#callback
undefined method `encode_json' for true:TrueClass
私たちは皆、エラーが嫌いなので、私もそうです。どうすればこれを修正できますか?ありがとう。
解決
info!
メソッドはのインスタンスを返します FBGraph::Result
, 、電話する必要があります data
その上に、RailsがJSONにエンコードできるように。次のコードは私のために正常に機能します:
render :json => client.selection.me.info!.data
所属していません StackOverflow