Rails, Facebooker and Double Slashes in Resource Routes

So, I’m working a Rails app and everything is going smoothly. I installed Facebooker (the plugin to interface with Facebook Connect) and got it integrated with my app’s user authentication in almost no time—perfect. But somehow between rails app and installing Facebooker, all of my stylesheet and javascript links broke (using, of course, the default javascript_include_tag and stylesheet_link_tag). The links now had a mysterious double slash after the host name (i.e., domain.tld//stylesheets/scaffold.css; domain.tld//javascripts/application.js). Truly odd. After scouring the internet and talking to some friends, no one could proffer any information on how to fix the issue. Evan and I spent a lot of frustration over this. Even stranger: the link tags worked as expected on the server in production and were only broken in development.

I stepped away from it and after a serious inspiration session from my muse, I solved the issue in five minutes. Seriously, it’s quite simple: in config/facebooker.yml, be sure that your callback_url does not have a trailing slash—in any environment. That’s it, problem solved.

About Logan Leger

Logan Leger is a native Louisianaian and technologist. He is currently a computer engineering student at LSU and is employed there in the ITS department. He also works with Noteflood and NewAperio, his own startup he founded with classmates from LSMSA. You can read more about him here.
This entry was posted in Code and tagged Code, newaperio, rails. Bookmark the permalink.

8 Responses to Rails, Facebooker and Double Slashes in Resource Routes

  1. Erik Dungan says:

    I just spent an hour trying to track down this issue. There are even 2 unanswered questions regarding this on StackOverflow.

    Thanks for the help and preventing my insanity :)

  2. I am having a similar issue, the post authorize redirect url in the new facebook forces you to use a trailing slash, now after every time a user tries to authorize the app theyre being redirected to a url with two slashes after the redirect url. I do not have a trailing slash on my callback url in my facebooker.yml file. I haven’t seen any solutions to this thus far. Anyone run into this problem?

  3. Anurag Jain says:

    Great catch! This had the potential to be a solid time waster for me, but this got the issue resolved quickly! Awesome!

  4. I figured my double slash issue out if anyone was having a problem similar to what i listed below. The problem was that apparently with the new facebook you cant add a redirect url in the settings, just leave it blank. Also, sometimes the new settings -do- take a few minutes to take effect. Hope this helps, somebody…

  5. flamontagne says:

    Thanks! Works like a charm

  6. Sam Wilson says:

    Man, you helped me out. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>