mbleigh-subdomain-fu 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/subdomain_fu/routing_extensions.rb +6 -1
- data/lib/subdomain_fu/url_rewriter.rb +13 -11
- data/subdomain-fu.gemspec +1 -1
- metadata +1 -1
|
@@ -31,4 +31,9 @@ end
|
|
|
31
31
|
|
|
32
32
|
ActionController::Routing::RouteSet.send :include, SubdomainFu::RouteSetExtensions
|
|
33
33
|
ActionController::Routing::Route.send :include, SubdomainFu::RouteExtensions
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
# UrlRewriter::RESERVED_OPTIONS is only available in Rails >= 2.2
|
|
36
|
+
# http://www.portallabs.com/blog/2008/12/02/fixing-subdomain_fu-with-named-routes-rails-22/
|
|
37
|
+
if Rails::VERSION::MAJOR >= 2 and Rails::VERSION::MINOR >= 2
|
|
38
|
+
ActionController::UrlRewriter::RESERVED_OPTIONS << :subdomain
|
|
39
|
+
end
|
|
@@ -27,18 +27,20 @@ module ActionController
|
|
|
27
27
|
alias_method_chain :rewrite_url, :subdomains
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
module
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
if Rails::VERSION::MAJOR >= 2 and Rails::VERSION::MINOR <= 1
|
|
31
|
+
# hack for http://www.portallabs.com/blog/2008/10/22/fixing-subdomain_fu-with-named-routes/
|
|
32
|
+
module Routing
|
|
33
|
+
module Optimisation
|
|
34
|
+
class PositionalArgumentsWithAdditionalParams
|
|
35
|
+
def guard_condition_with_subdomains
|
|
36
|
+
# don't allow optimisation if a subdomain is present - fixes a problem
|
|
37
|
+
# with the subdomain appearing in the query instead of being rewritten
|
|
38
|
+
# see http://mbleigh.lighthouseapp.com/projects/13148/tickets/8-improper-generated-urls-with-named-routes-for-a-singular-resource
|
|
39
|
+
guard_condition_without_subdomains + " && !args.last.has_key?(:subdomain)"
|
|
40
|
+
end
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
alias_method_chain :guard_condition, :subdomains
|
|
43
|
+
end
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
46
|
end
|
data/subdomain-fu.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "subdomain-fu"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.4"
|
|
4
4
|
s.date = "2008-06-25"
|
|
5
5
|
s.summary = "Provides a simple solution for route handling and linking between subdomains in a Rails application."
|
|
6
6
|
s.email = "michael@intridea.com"
|