Help! How to redirect if SSL applied

I'm working on the client side, the server had been applied with SSL.
In my client, If the server is secured with SSL, the https shall be used
automatically, or say "redirecting";
otherwise only use http to access the server.
I didn't know how to implement.
I want to using ssl_required plugin as some direction, but not succeed.
I installed ssl_requirement plugin.
Then in coding as:
require "ssl_requirement"
class MyController < ApplicationController
  include SslRequirement
  ssl_allowed :update
##I tried ssl_required :update An error occurred, saying:
##The page is temporarily unavailable. (IIS-404)
##while for ssl_allowed :update the https still can't be used, only go
to http.

def update
    respond_to do |format|
      format.html {
          redirect_to ( RelativeUrlfromLocalHost )
It doesn't work.

In ssl_required plugin, I saw the judgment :
if ssl_required? && !request.ssl?
However, I'm not clear what is request here ? How can I "bind" it to
my accessing server.
Is there anyone can help me?
Thanks alot!!