Ruby on Rails
HowToEnableSSL (Version #8)

To enable SSL in your rails app, do the following:

  • Run ruby script/plugin install ssl_requirement.
  • Add include SslRequirement to your ApplicationController (located in app/controller/application_controller.rb.
  • In each controller that you wish to force SSL, add the line ssl_required :action1, :action2 (where :action1 and :action2 are the actions on which you wish to force SSL) to the top of the controller class.
  • In each controller that you wish to allow (but not require) SSL, add the line ssl_allowed :action1, :action2 to the top of the controller class.

Optional: If you wish to force SSL for all actions in a controller or for the entire application, add the following function to the controller_controller.rb or application_controller.rb, respectively:

<code lang="ruby">
def ssl_required?
  true
end

more:

  • README:“http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/README
  • repository:“http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/”

To enable SSL in your rails app, do the following:

  • Run ruby script/plugin install ssl_requirement.
  • Add include SslRequirement to your ApplicationController (located in app/controller/application_controller.rb.
  • In each controller that you wish to force SSL, add the line ssl_required :action1, :action2 (where :action1 and :action2 are the actions on which you wish to force SSL) to the top of the controller class.
  • In each controller that you wish to allow (but not require) SSL, add the line ssl_allowed :action1, :action2 to the top of the controller class.

Optional: If you wish to force SSL for all actions in a controller or for the entire application, add the following function to the controller_controller.rb or application_controller.rb, respectively:

<code lang="ruby">
def ssl_required?
  true
end

more:

  • README:“http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/README
  • repository:“http://dev.rubyonrails.org/svn/rails/plugins/ssl_requirement/”