I just completed a reasonably painful Facebook Canvas app integration and 
wanted to share a couple high-level gotcha's I ran into using the 
Facebooker2 RoR plugin.

My current environment-- this is the one that finally worked, so my 
recommendation is to implement using these:
ruby: 1.8.7
rails: 2.3.12
Heroku stack: bamboo-ree-1.8.7

If you need to migrate to bamboo be sure and follow the instructions 
provided on Heroku <http://devcenter.heroku.com/articles/bundler> and not 
the instructions on the Bundler site. 

First, of course read the core dev docs at Facebook:

   - http://developers.facebook.com/docs/guides/canvas/
   - http://developers.facebook.com/docs/reference/api/user/
   

Installing Facebooker2:
My biggest issue (aside from migrating stacks on Heroku) was learning to 
work with a Rack app. For my pre Rails 3 app I made the following 
modifications to process:

   - Did not use config.ru file. I'm sure there are a lot of Rack gurus who 
   can add detail to why or why not to run a config.ru file, but my final 
   solution involved removing this file.
   - Created Facebook.rb in /lib dir
   - Removed Module::Rack declaration from Facebook.rb
      - my final version of Facebook.rb contains ONLY the class declaration 
      for Facebook and not the surrounding Module declaration used in the 
      Facebooker2 instructions
   - Added request = Rack::Request.new(env) to Facebook.rb 
   - After removing Module::Rack from Facebook.rb had to access request 
      directly through Rack obj
         - Again, ninjas please chime in on how this could have been 
         best-ier practiced... but remember, my solution worked! :)
      - Add to environment.rb
      - config.middleware.use "Facebook" directly below: 
      Rails::Initializer.run do |config|
   - /vendor/plugins/facebooker2/lib/rails/controller.rb at ~ line 56 
   replaced 
   - user = Mogli::User.new(:id=>userid)
      - with
         -  user = Mogli::User.find(userid, client)
      - Finally, tiny issue with ssl was solved by changing settings in my 
   facebook app control panel to point ssl requests to my app via heroku and by 
   deploying the piggback addon <http://devcenter.heroku.com/articles/ssl>


I'm sure I've left stuff out and I'm sure examples of real code would help 
anyone actually attempting this work, so please ping if anyone needs 
additional assistance my experience might provide.




-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/heroku/-/c0kEN1nJ01cJ.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to