Skip to content

Instantly share code, notes, and snippets.

@brandon-beacher
Created February 29, 2012 13:59
Show Gist options
  • Save brandon-beacher/1941046 to your computer and use it in GitHub Desktop.
Save brandon-beacher/1941046 to your computer and use it in GitHub Desktop.
# an module to redirect a controller to http from https
# drop this in lib/httpable.rb
module Httpable
def self.included(base)
base.send :include, InstanceMethods
base.before_filter :redirect_to_http
end
module InstanceMethods
private
def redirect_to_http
redirect_to :protocol => "http" if request.ssl?
end
end
end
# include this module into controllers which should redirect to http
class PagesController < ApplicationController
include Httpable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment