module ActionController::ForceSSL
def force_ssl_redirect(host_or_options = nil)
def force_ssl_redirect(host_or_options = nil) unless request.ssl? options = { protocol: "https://", host: request.host, path: request.fullpath, status: :moved_permanently, } if host_or_options.is_a?(Hash) options.merge!(host_or_options) elsif host_or_options options[:host] = host_or_options end secure_url = ActionDispatch::Http::URL.url_for(options.slice(*URL_OPTIONS)) flash.keep if respond_to?(:flash) && request.respond_to?(:flash) redirect_to secure_url, options.slice(*REDIRECT_OPTIONS) end end