lib/subdomain_fu/url_rewriter.rb in mbleigh-subdomain-fu-0.1.0 vs lib/subdomain_fu/url_rewriter.rb in mbleigh-subdomain-fu-0.3.0

- old
+ new

@@ -1,34 +1,35 @@ 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[:only_path] = false if SubdomainFu.override_only_path? 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 + if SubdomainFu.needs_rewrite?(options[:subdomain], (options[:host] || @request.host_with_port)) || options[:only_path] == false + options[:only_path] = false if SubdomainFu.override_only_path? options[:host] = SubdomainFu.rewrite_host_for_subdomains(options.delete(:subdomain), options[:host] || @request.host_with_port) + puts "options[:host]: #{options[:host].inspect}" 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 @@ -42,6 +43,6 @@ alias_method_chain :guard_condition, :subdomains end end end end -end \ No newline at end of file +end