ruby-on-railsruby-on-rails-3rubygemsfacebooker2

rails gem outputting broken javascript


I've been using this gem for my facebook canvas app: https://github.com/dekart/facebooker2.git

Today I swapped it out for another facebook auth gem, decided I didn't like it and went back to my original.

I'm including the gem like this:

gem 'facebooker2', :git => "https://github.com/dekart/facebooker2.git"

Since I've made this change, the facebooker2 gem has being causing javascript errors in my app.

 window.fbAsyncInit = function() {
                        FB.init({
          appId  : 'myappid',
          status : true, // check login status
          cookie : true, // enable cookies to allow the server to access the session
          xfbml  : true,  // parse XFBML
          oauth  : true
          channelUrl : 'http://myurl/channel.html'
        });

There is a missing comma after the oauth: true this means my facebook login button will not render.

How do I fix this? Ideally, I'd like to go into the gem, see why it's missing the comma and fix it. Then use my fixed version of the gem on my local machine and on heroku. If you can offer an alternative solution, it would be much appreciated.


Solution

  • There's a "Fork and edit this file" button on this page (near the top): https://github.com/dekart/facebooker2/blob/master/lib/facebooker2/rails/helpers/javascript.rb

    You can edit the file directly on the Github website (hint: look at line 51) and use

    gem 'facebooker2', :git=> "https://github.com/yourusername/facebooker2.git"
    

    in your Gemfile to use your fork.

    You can also be a good open-source citizen and submit a pull request afterwards, an obvious fix like this one is likely to be accepted fast.