George Deglin
2008-Jul-11 00:47 UTC
[Facebooker-talk] canvas url rewriting fails for templates loaded through ajax
I just encountered a bug that caused the links in my partials to be generated as non-canvas routes when the partial was loaded via ajax. This bug is due to facebooker url rewriting checking for fb_sig_in_canvas to determine if the application is running in or outside a canvas, and fb_sig_in_canvas is not sent for ajax requests. My hacked together patch diff is below, sorry I didn''t have a chance to write tests or closely verify that my changes won''t break anything else. a/vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_rewriting.rb b/vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_rewriting.rb index 00b1e1d..e81a316 100644 --- a/vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_rewriting.rb +++ b/vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_rewriting.rb @@ -11,7 +11,7 @@ module ::ActionController def link_to_canvas?(params, options) option_override = options[:canvas] return false if option_override == false # important to check for false. nil should use default behavior - option_override || @request.parameters["fb_sig_in_canvas"] == "1" || @request.parameters[:fb_sig_in_canvas] == "1" + option_override || (@request.parameters["fb_sig_in_canvas"] == "1") || (@request.parameters[:fb_sig_in_canvas] == "1") || (@request.parameters[:fb_sig_is_ajax]=="1") end def rewrite_url_with_facebooker(*args) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20080710/fc90cbdb/attachment-0001.html>