I am doing the following in a Facebook Request:
function sendRequests() {
FB.ui({
method: 'apprequests',
message: "You are invited to the surprise Birthday",
data:{"board_id":<%=@board.id%>}
When I get the request object from the user who accepted the application I parse it as a JSON object as follows:
ActiveSupport::JSON.decode(request_body.body)
All of the information is formatted as a Hash should in Rails except for the data I sent in which looks as follows:
"data"=>"{\"board_id\":1}"
I have tried all kinds of combinations but it just won’t convert properly. Am I missing something or does the JSON returned by the facebook graph api need to be formatted differently?
In the end I did the following:
In the facebook fb.ui
Then in the controller after the request is accepted in facebook:
I have to decode twice. Once for the whole request and the second time for the specific data information passed. It might not be pretty but it works.