Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make url_for_with_secure_option & url_for_with_non_ssl_host compatible #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/url_for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Routing
class RouteSet

# Add a secure option to the rewrite method.
def url_for_with_secure_option(options = {})
def url_for_with_secure_option(options = {}, *args)
secure = options.delete(:secure)

# if secure && ssl check is not disabled, convert to full url with https
Expand All @@ -30,18 +30,18 @@ def url_for_with_secure_option(options = {})
end
end

url_for_without_secure_option(options)
url_for_without_secure_option(options, *args)
end

# if full URL is requested for http and we've been told to use a
# non-ssl host override, then use it
def url_for_with_non_ssl_host(options)
def url_for_with_non_ssl_host(options, *args)
if !options[:only_path] && !SslRequirement.non_ssl_host.nil?
if !(/^https/ =~ (options[:protocol] || @request.try(:protocol)))
options.merge! :host => SslRequirement.non_ssl_host
end
end
url_for_without_non_ssl_host(options)
url_for_without_non_ssl_host(options, *args)
end

# want with_secure_option to get run first (so chain it last)
Expand Down