Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 756c27ad01
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (22 sloc) 0.556 kb
module SimpleSSLRequirement
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
private
def require_ssl
if !request.ssl?
redirect_to "https://#{request.host}#{request.fullpath}"
flash.keep
end
end
end
end
module ClassMethods
def ssl_required(options={})
options.reverse_merge!(:environments => %w(production staging test))
if options.delete(:environments).include?(Rails.env)
before_filter :require_ssl, options
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.