Module: ActionController::ForceSSL::ClassMethods

Defined in:
lib/nimbleshop/core_ext/force_ssl.rb

Instance Method Summary collapse

Instance Method Details

#force_ssl(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nimbleshop/core_ext/force_ssl.rb', line 13

def force_ssl(options = {})
  host = options.delete :host
  before_filter(options) do
    if !request.ssl?# && !Rails.env.development?
      redirect_options = {protocol: 'https://', status: :moved_permanently}
      redirect_options.merge! host: host if host
      redirect_options.merge! params: request.query_parameters
      redirect_to redirect_options
    end
  end
end