require 'facebooker/rails/controller'
require 'ruby-debug'
module ::ActionController
  class Base
    def self.inherited_with_facebooker(subclass)
      inherited_without_facebooker(subclass)
      if subclass.to_s == "ApplicationController"
        subclass.send(:include,Facebooker::Rails::Controller) 
        subclass.helper Facebooker::Rails::Helpers
      end
    end
    class << self
      alias_method_chain :inherited, :facebooker
    end

  end
  
  class AbstractRequest                         
    def relative_url_root                       
      "/#{ENV['FACEBOOKER_RELATIVE_URL_ROOT']}" 
    end                                         
  end                                           
  class UrlRewriter
    
    def link_to_canvas?(params)
      #yes, we do really want to see if it is false. nil means use the default action
      canvas = params.delete(:canvas)
      return false  if canvas == false 
      canvas || params[:fb_sig_in_canvas] == "1"
    end
    
    def rewrite_url_with_facebooker(*args)
      if args.first.is_a?(Hash)
        options=args.first
      else
        options = args.last
      end
      options[:skip_relative_url_root] ||= true
      if !options.has_key?(:host) && link_to_canvas?(@request.request_parameters)
        options[:skip_relative_url_root] = false
        options[:host] = "apps.facebook.com"
      end
      rewrite_url_without_facebooker(*args)
    end
    
    alias_method_chain :rewrite_url, :facebooker
  end
end
require 'facebooker/rails/facebook_session_handling'
require 'facebooker/rails/controller'
require 'ruby-debug'
module ::ActionController
  class Base
    def self.inherited_with_facebooker(subclass)
      inherited_without_facebooker(subclass)
      if subclass.to_s == "ApplicationController"
        subclass.send(:include,Facebooker::Rails::Controller) 
        subclass.helper Facebooker::Rails::Helpers
      end
    end
    class << self
      alias_method_chain :inherited, :facebooker
    end

  end
  
  class AbstractRequest                         
    def relative_url_root                       
      "/#{ENV['FACEBOOKER_RELATIVE_URL_ROOT']}" 
    end                                         
  end                                           
  class UrlRewriter
    
    def link_to_canvas?(params)
      #yes, we do really want to see if it is false. nil means use the default action
      canvas = params.delete(:canvas)
      return false  if canvas == false 
      canvas || params["fb_sig_in_canvas"] == "1" ||  params[:fb_sig_in_canvas] == "1"
    end
    
    def rewrite_url_with_facebooker(*args)
      if args.first.is_a?(Hash)
        options=args.first
      else
        options = args.last
      end
      options[:skip_relative_url_root] ||= true
      if !options.has_key?(:host) && link_to_canvas?(@request.request_parameters)
        options[:skip_relative_url_root] = false
        options[:host] = "apps.facebook.com"
      end
      rewrite_url_without_facebooker(*args)
    end
    
    alias_method_chain :rewrite_url, :facebooker
  end
end
require 'facebooker/rails/facebook_session_handling'
Fix link_to_canvas? checking for param as symbol but getting it as string
Fix link_to_canvas? checking for param as symbol but getting it as string

git-svn-id: abd3364c23bece18756deaf5558fcfa62d3b1b71@96 06148572-b36b-44fe-9aa8-f68b04d8b080
