Permalink
Browse files

Revert "* lib/journey/formatter.rb: when generating routes, skip route"

This reverts commit 45d4e9e.
  • Loading branch information...
1 parent e4755e0 commit 06208ad6e23044418861ca86b0d9e90ce69ca2d8 @lifo committed Aug 14, 2012
Showing with 4 additions and 16 deletions.
  1. +0 −10 CHANGELOG.rdoc
  2. +1 −2 lib/journey/formatter.rb
  3. +3 −4 test/test_router.rb
View
@@ -1,13 +1,3 @@
-Thu Jun 14 14:03:22 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/journey/formatter.rb: when generating routes, skip route
- literals (routes that do not have replacement values like
- "/:controller") when matching unnamed routes.
-
- https://github.com/rails/rails/issues/6459
-
- * test/test_router.rb: corresponding test
-
Wed Feb 15 11:49:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* lib/journey/formatter.rb: reject non-truthy parameters parts.
View
@@ -14,6 +14,7 @@ def generate type, name, options, recall = {}, parameterize = nil
constraints = recall.merge options
match_route(name, constraints) do |route|
+
keys_to_keep = route.parts.reverse.drop_while { |part|
!options.key?(part) || (options[part] || recall[part]).nil?
}
@@ -30,8 +31,6 @@ def generate type, name, options, recall = {}, parameterize = nil
parameterized_parts.keep_if { |_,v| v }
- next if !name && route.requirements.empty? && route.parts.empty?
-
next unless verify_required_parts!(route, parameterized_parts)
params = options.dup.delete_if do |key, _|
View
@@ -302,12 +302,11 @@ def test_nil_path_parts_are_ignored
end
def test_generate_slash
+ path = Path::Pattern.new '/'
+ @router.routes.add_route nil, path, {}, {}, {}
+
params = [ [:controller, "tasks"],
[:action, "show"] ]
- str = Router::Strexp.new("/", Hash[params], ['/', '.', '?'], true)
- path = Path::Pattern.new str
-
- @router.routes.add_route nil, path, {}, {}, {}
path, _ = @formatter.generate(:path_info, nil, Hash[params], {})
assert_equal '/', path

0 comments on commit 06208ad

Please sign in to comment.