Sha256: c23f4432da34b8d32f6bf7530eebd84fbe0927af8d647a22e54ce7108b8bd011

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

module Upjs
  module Rails
    module Redirection

      def redirect_to(*args)
        super
        flash[:redirected_to] = self.location if request.up?
      end

      def self.included(base)
        base.before_filter :extract_redirect_location
      end

      private

      def extract_redirect_location
        if location = flash[:redirected_to]
          headers['X-Up-Previous-Redirect-Location'] = location
        end
      end

      ActionController::Base.include(self)

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
upjs-rails-0.2.1 lib/upjs/rails/redirection.rb
upjs-rails-0.2.0 lib/upjs/rails/redirection.rb
upjs-rails-0.1.0 lib/upjs/rails/redirection.rb