Class: ActionController::UrlRewriter

Inherits:
Object
  • Object
show all
Defined in:
lib/url_rewriter.rb

Instance Method Summary collapse

Instance Method Details

#rewrite_with_secure_option(options = {}) ⇒ Object

Add a secure option to the rewrite method.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/url_rewriter.rb', line 7

def rewrite_with_secure_option(options = {})
  secure = options.delete(:secure)
  if !secure.nil? && !SslRequirement.disable_ssl_check?
    if secure == true || secure == 1 || secure.to_s.downcase == "true"
      options.merge!({
        :only_path => false,
        :protocol => 'https'
      })
    else
      options.merge!({
        :only_path => false,
        :protocol => 'http'
      })
    end
  end
  
  rewrite_without_secure_option(options)
end