![]() | Using form_tag within FB app and Facebooker routes |
|
05 Sep 2008, 04:33
Paul Covell (5 posts) |
I am building a search query and so I would like the behavior to be like this:
Products is RESTful, so I also use GET /products//show &c. routes.rb:
products_controller.rb:
search.fbml.erb:
Generates HTML:
Which, when data is entered, generates a GET to my application (dev log)
Finally leading to the error:
I am open to other ways of doing it, but I do like having the search parameters in the URL for bookmarking/sending to others.
Is there a correct recipe for this behavior? I assume other people are building searches or other form input not directly related to an ActiveRecord object, so I think more treatment would be generally valuable. In this case, it would be nice to know more about what’s going on under the hood in Facebooker—I know that it is doing some magic to make RESTful routes work in the first place. My next stop is to read the code, but I was hoping to avoid this. Thanks for any help. Cheers, |
|
05 Sep 2008, 06:24
Paul Covell (5 posts) |
Ok I have solved the IncorrectSignature error explained above. The error can be reproduced by using :method => :get in the form_tag (in my case it was instead an unclosed form tag earlier on causing a get request—but the results are the same). The workaround for getting search terms into the URL seems to be a redirect within the action:
This may be unavoidable given the structure of: Browser < Anyone confirm this? |
|
05 Sep 2008, 12:39
Mike Mangino (543 posts) |
I think the problem is in a slightly different place than you think. Your form is generating a POST form. You showed the code:
What you probably want is:
Using By default, |
|
06 Sep 2008, 05:53
Paul Covell (5 posts) |
Mike, sorry I wasn’t clear earlier—when I use :method => :get I get the IncorrectSignature exception. I tried your suggestion to verify, and the error is exactly the same. If I remove :method => :get to get the POST method, it works fine (but I don’t get my bookmarkable URLs—if I want those, I can do the redirect trick above, caveat as stated). This is probably some special case not caught in Facebooker, but I am shying away from that code (scary..) Now I’m on to a slightly different topic, still forms-related: I’ve gotten all this to work before with PHP, so I’m familiar with how it should work but I’m having a tough time getting good information on how to do it with Facebooker/Rails: - I’m trying to load a friend’s profile data for viewing and I need a dialog box to select the “target” friend. I successfully coded it up before as a FBJS new Dialog.showChoice(‘Select Target’, choose_target_dialog) with choose_target_dialog as a js-string. Now I’ve got a snag : I need to post to /url, not /url, but I don’t know how to get that URL. There aren’t any examples anywhere (at least with a bit of Googling) covering this kind of usage AFAICT. Cheers, and thanks again. |
|
08 Sep 2008, 13:25
Mike Mangino (543 posts) |
In your previous example, can you provide a simple testcase that gives an invalid signature exception? I’m the maintainer of Facebooker and I’d love to get that fixed. Mike |
|
17 Sep 2008, 08:17
Paul Covell (5 posts) |
Mike, I’ve managed to re-create this with a basic installation: rails test views/home/index.fbml.erb:
app/controller/application.rb—added immediately below helper :all ensure_application_is_installed_by_facebook_user ensure_authenticated_to_facebook And then I set up my development server and tunnel as I do with normal development. The error is the same. Also, if I remove the :method => :get, the error does not occur. If you like I can send files to the mailing list or to you on the facebooker-talk list. -Paul |
|
17 Sep 2008, 17:18
Mike Mangino (543 posts) |
Yuck. I see the same issue, but I don’t know why. In the short term, I’d say you can just use POSTS for this. I’ll keep trying to figure this out and get it fixed. Mike |
|
20 Sep 2008, 01:25
Christopher Sepic (10 posts) |
I’m having the exact same problem. Let me know if you figure anything out! |
|
20 Sep 2008, 20:49
Mike Mangino (543 posts) |
Can you guys report this to the facebooker mailing list? I’m going to keep trying to figure it out, but maybe another couple of eyes would be helpful. Mike |
|
26 Sep 2008, 11:45
Paul Covell (5 posts) |
Posting now. |
|
10 Dec 2008, 20:06
Mike Mangino (543 posts) |
It took a few months, but I got a really small sample app that had this same behavior. It’s a Facebook bug, but there is a workaround for it in the most recent version of Facebooker. Mike |
|
24 Jun 2009, 22:29
William Hertling (23 posts) |
What is the final resolution to this? I’m having a similar problem now with a form submission. |
|
25 Jun 2009, 13:01
Mike Mangino (543 posts) |
The newest version of Facebooker should include a fix. Facebook is resistent to fixing the bug on their end. |
| You must be logged in to comment |

