[Facebooker-talk] Facebooker scaffolding errors
Stéphane Akkaoui
stephane.akkaoui at imeuble.info
Fri Nov 7 07:13:19 EST 2008
Hi Sam,
Soory for the delay... you may have fix your problem now.
But still, i give you some answers, they could be interesting for
others to.
Le 3 nov. 08 à 21:35, Sam Joseph a écrit :
> we removed the trailing slash:
> canvas_page_name: http://apps.facebook.com/stem_survey
The canvas page name is not an url. It's juste a name.
As I told you before, for your app, it's :
canvas_page_name: stem_survey
>>> format.fbml { redirect_to('http://apps.facebook.com/stem_survey/survey_responses/'+@survey_response.id.to_s)
>>> }
>>
>> If the canvas_page_name field is correctly set, you should be able
>> to do : redirect_to(@survey_response, :canvas => true)
> Did that, but got this error:
>
> ArgumentError in Survey responsesController#create
>
> wrong number of arguments (2 for 1)
Here is an example :
# in config/root.rb
map.resources :messages
# in script/console
>> app.messages_url()
=> "http://www.example.com/messages"
>> app.messages_url(:canvas => true)
=> "http://apps.new.facebook.com/alisterapptrois/messages"
>> @message = Message.find(:first)
=> #<Message id: 29, user_id: 1278968509, body: "coucou les gens",
page_uid: 26149797103, created_at: "2008-10-16 13:59:04", updated_at:
"2008-10-16 13:59:04">
>> app.message_url(@message, :canvas => true)
=> "http://apps.new.facebook.com/canvas_page_name/messages/29"
>> app.message_url(@message, :canvas => false)
=> "http://www.example.com/messages/29"
>> app.message_url(@message)
=> "http://www.example.com/messages/29"
# in app/controller/hello_controller
def foo
@message = Message.find(:first)
redirect_to( message_url(@message, :canvas => true))
end
# in script/server (logs after calling http://localhost:3000/hello/toto)
Processing HelloController#toto (for 127.0.0.1 at 2008-11-07
13:03:53) [GET]
Session ID: 3c6050ab0cfc62d75ddc7a1441792271
Parameters: {"action"=>"toto", "controller"=>"hello"}
Message Load (0.000276) SELECT * FROM `messages` LIMIT 1
Message Columns (0.002220) SHOW FIELDS FROM `messages`
Redirected to http://apps.new.facebook.com/canvas_page_name/messages/29
Completed in 0.00896 (111 reqs/sec) | DB: 0.00312 (34%) | 302 Found [http://localhost/hello/toto
]
# in app/controller/hello_controller
def foo
@message = Message.find(:first)
redirect_to( message_url(@message))
end
# in script/server (logs after calling http://localhost:3000/hello/toto)
Processing HelloController#toto (for 127.0.0.1 at 2008-11-07
13:03:08) [GET]
Session ID: 3c6050ab0cfc62d75ddc7a1441792271
Parameters: {"action"=>"toto", "controller"=>"hello"}
Message Load (0.000266) SELECT * FROM `messages` LIMIT 1
Message Columns (0.001918) SHOW FIELDS FROM `messages`
Redirected to http://localhost:3000/messages/29
Completed in 0.01750 (57 reqs/sec) | DB: 0.00615 (35%) | 302 Found [http://localhost/hello/toto
]
HTH,
--
Stéphane Akkaoui
http://www.sociabliz.com (fr)
http://imeuble.info (fr)
More information about the Facebooker-talk
mailing list