ActionController::ForceSSL::ClassMethods

module ActionController::ForceSSL::ClassMethods

Public Instance Methods

force_ssl(options = {}) Show source

Force the request to this particular controller or specified actions to be under HTTPS protocol.

If you need to disable this for any reason (e.g. development) then you can use an :if or :unless condition.

class AccountsController < ApplicationController
  force_ssl if: :ssl_configured?

  def ssl_configured?
    !Rails.env.development?