Sha256: 4f5b08acbe4e3f61bc920fd74c30efc5a7ff5ce37a4ba808ba0125ba416a60ce
Contents?: true
Size: 1.88 KB
Versions: 1
Compression:
Stored size: 1.88 KB
Contents
module ActionController module UrlWriter def url_for_with_subdomains(options) if SubdomainFu.needs_rewrite?(options[:subdomain], options[:host] || default_url_options[:host]) || options[:only_path] == false options[:only_path] = false options[:host] = SubdomainFu.rewrite_host_for_subdomains(options.delete(:subdomain), options[:host] || default_url_options[:host]) else options.delete(:subdomain) end url_for_without_subdomains(options) end alias_method_chain :url_for, :subdomains end class UrlRewriter #:nodoc: private def rewrite_url_with_subdomains(options) if SubdomainFu.needs_rewrite?(options[:subdomain], options[:host] || @request.host_with_port) || options[:only_path] == false options[:only_path] = false options[:host] = SubdomainFu.rewrite_host_for_subdomains(options.delete(:subdomain), options[:host] || @request.host_with_port) else options.delete(:subdomain) end rewrite_url_without_subdomains(options) end alias_method_chain :rewrite_url, :subdomains end if Rails::VERSION::MAJOR >= 2 and Rails::VERSION::MINOR <= 1 # hack for http://www.portallabs.com/blog/2008/10/22/fixing-subdomain_fu-with-named-routes/ module Routing module Optimisation class PositionalArgumentsWithAdditionalParams def guard_condition_with_subdomains # don't allow optimisation if a subdomain is present - fixes a problem # with the subdomain appearing in the query instead of being rewritten # see http://mbleigh.lighthouseapp.com/projects/13148/tickets/8-improper-generated-urls-with-named-routes-for-a-singular-resource guard_condition_without_subdomains + " && !args.last.has_key?(:subdomain)" end alias_method_chain :guard_condition, :subdomains end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mbleigh-subdomain-fu-0.1.0 | lib/subdomain_fu/url_rewriter.rb |