Sha256: 726205be52b70dd6e66635f34497943775f0cc3fe2ed6487169de0797eba5b48

Contents?: true

Size: 1.92 KB

Versions: 29

Compression:

Stored size: 1.92 KB

Contents

module ActionController
  class CgiRequest
    alias :initialize_aliased_by_facebooker :initialize

    def initialize(cgi, session_options = {})
      initialize_aliased_by_facebooker(cgi, session_options)
      @cgi.instance_variable_set("@request_params", request_parameters.merge(query_parameters))
    end
    
    DEFAULT_SESSION_OPTIONS[:cookie_only] = false
  end 
end

module ActionController
  class RackRequest < AbstractRequest #:nodoc:
    alias :initialize_aliased_by_facebooker :initialize

    def initialize(cgi, session_options = {})
      initialize_aliased_by_facebooker(cgi, session_options)
      @cgi.instance_variable_set("@request_params", request_parameters.merge(query_parameters))
    end
  end 
end

class CGI  
  class Session
    private
      alias :initialize_aliased_by_facebooker :initialize
      attr_reader :request, :initialization_options

      def initialize(request, option={})
        @request = request
        @initialization_options = option
        option['session_id'] ||= set_session_id
        initialize_aliased_by_facebooker(request, option)
      end
      
      def set_session_id
        if session_key_should_be_set_with_facebook_session_key? 
          request_parameters[facebook_session_key]
        else 
          request_parameters[session_key]
        end
      end

      def request_parameters
        request.instance_variable_get("@request_params")
      end

      def session_key_should_be_set_with_facebook_session_key?
        request_parameters[session_key].blank? && !request_parameters[facebook_session_key].blank?
      end

      def session_key
        initialization_options['session_key'] || '_session_id'
      end

      def facebook_session_key
        'fb_sig_session_key'
      end

      alias :create_new_id_aliased_by_facebooker :create_new_id

      def create_new_id
        @new_session = true
        @session_id || create_new_id_aliased_by_facebooker
      end
  end
end

Version data entries

29 entries across 29 versions & 7 rubygems

Version Path
al-facebooker-1.0.12.1 lib/facebooker/rails/facebook_session_handling.rb
al-facebooker-1.0.12 lib/facebooker/rails/facebook_session_handling.rb
corey-facebooker-1.0.28.1 lib/facebooker/rails/facebook_session_handling.rb
djanowski-facebooker-1.0.12 lib/facebooker/rails/facebook_session_handling.rb
mborromeo-facebooker-1.0.28 lib/facebooker/rails/facebook_session_handling.rb
mborromeo-facebooker-1.0.29 lib/facebooker/rails/facebook_session_handling.rb
mborromeo-facebooker-1.0.30 lib/facebooker/rails/facebook_session_handling.rb
mborromeo-facebooker-1.0.31 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.12 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.13 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.14 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.15 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.16 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.19 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.20 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.21 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.22 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.23 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.24 lib/facebooker/rails/facebook_session_handling.rb
mmangino-facebooker-1.0.25 lib/facebooker/rails/facebook_session_handling.rb