Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 0 commit comments
  • 1 contributor
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
10 CHANGELOG.rdoc
@@ -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
3  lib/journey/formatter.rb
@@ -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
7 test/test_router.rb
@@ -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

No commit comments for this range

Something went wrong with that request. Please try again.