module SslRoutes::ActionDispatch

Public Class Methods

included(base) click to toggle source
# File lib/ssl_routes/rails.rb, line 79
def self.included(base)
  base.send :alias_method_chain, :url_for, :ssl_support
end

Public Instance Methods

url_for_with_ssl_support(options) click to toggle source
# File lib/ssl_routes/rails.rb, line 83
def url_for_with_ssl_support(options)
  ac = self.respond_to?(:controller) ? self.controller : self
  if ac.respond_to?(:enable_ssl) && ac.enable_ssl
    if options.is_a?(Hash)
      current, target = ac.determine_protocols(options)
      if current != target
        options.merge!({ :protocol => target, :only_path => false })
      end
    end
  end
  url_for_without_ssl_support(options)
end