module ActionController::ForceSSL::ClassMethods
def force_ssl(options = {})
* only - The callback should be run only for this action
==== Options
Note that this method will not be effective on development environment.
under HTTPS protocol.
Force the request to this particular controller or specified actions to be
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