From d68f27e9b184a8e7e4ce71db11874a6b36ea1edc Mon Sep 17 00:00:00 2001 From: Ben Scheirman Date: Sat, 8 Oct 2011 18:38:02 -0500 Subject: accept optional :host parameter to force_ssl --- actionpack/lib/action_controller/metal/force_ssl.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/metal/force_ssl.rb b/actionpack/lib/action_controller/metal/force_ssl.rb index ed693c5967..0fd42f9d8a 100644 --- a/actionpack/lib/action_controller/metal/force_ssl.rb +++ b/actionpack/lib/action_controller/metal/force_ssl.rb @@ -24,12 +24,15 @@ module ActionController # * only - The callback should be run only for this action # * except - The callback should be run for all actions except this action def force_ssl(options = {}) + host = options.delete(:host) before_filter(options) do if !request.ssl? && !Rails.env.development? - redirect_to :protocol => 'https://', :status => :moved_permanently + redirect_options = {:protocol => 'https://', :status => :moved_permanently} + redirect_options.merge!(:host => host) if host + redirect_to redirect_options end end end end end -end \ No newline at end of file +end -- cgit v1.2.3