Recently, I had created a rails app which allows people to login with their Facebook account. Thanks to a few existing gems and plugins, the facebook connect integration was straight forward enough. A few gotchas but easily fixed.
However what had got me stump for a few hours was deploying my rails app on a sub directory. For example I was deploying it at http://example.com/myapp where myapp is my rails application but somehow oddly enough the facebooker gem thinks that myapp is a controller and couldn’t find any routes to it.
Turns out, it’s because of some weird relative url issue with facebooker gem. It just took a few lines of codes to rectify as follow
######################################################### # Facebooker hack. To make authlogic facebook_connect work # if app is deployed in sub directory. Put it at # config/initializers/facebooker_hack.rb ######################################################### Facebooker.module_eval do def self.path_prefix '/directory_name' end end
Kudos to this blog entry for pointing me to the right direction.

