Class ::UrlRewriter
In: lib/facebooker/rails/facebook_url_rewriting.rb
Parent: Object

Methods

Included Modules

Facebooker::Rails::BackwardsCompatibleParamChecks

Public Instance methods

rails blindly tries to merge things that may be nil into the parameters. Make sure this won‘t break

[Source]

# File lib/facebooker/rails/facebook_url_rewriting.rb, line 41
    def can_safely_access_request_parameters?
      @request.request_parameters
    end

[Source]

# File lib/facebooker/rails/facebook_url_rewriting.rb, line 34
    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 || (can_safely_access_request_parameters? && (one_or_true(@request.parameters["fb_sig_in_canvas"]) || one_or_true(@request.parameters[:fb_sig_in_canvas]) || one_or_true(@request.parameters["fb_sig_is_ajax"]) ))
    end

[Source]

# File lib/facebooker/rails/facebook_url_rewriting.rb, line 30
    def link_to_new_canvas?
      one_or_true @request.parameters["fb_sig_in_new_facebook"]
    end

[Source]

# File lib/facebooker/rails/facebook_url_rewriting.rb, line 45
    def rewrite_url_with_facebooker(*args)
      options = args.first.is_a?(Hash) ? args.first : args.last
      is_link_to_canvas = link_to_canvas?(@request.request_parameters, options)
      if is_link_to_canvas && !options.has_key?(:host)
        options[:host] = Facebooker.canvas_server_base
      end 
      options.delete(:canvas)
      Facebooker.request_for_canvas(is_link_to_canvas) do
        rewrite_url_without_facebooker(*args)
      end
    end

[Validate]