Skip to content

Commit

Permalink
Keep old params around only if its a cascade
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed May 18, 2011
1 parent 43ff977 commit 3490843
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/rack/mount/route_set.rb
Expand Up @@ -146,14 +146,15 @@ def call(env)
env[Prefix::KEY] = matches[:path_info].to_s
end

begin
old_params = env[@parameters_key]
env[@parameters_key] = (old_params || {}).merge(params)
old_params = env[@parameters_key]
env[@parameters_key] = (old_params || {}).merge(params)

result = route.app.call(env)
return result unless result[1][X_CASCADE] == PASS
ensure
result = route.app.call(env)

if result[1][X_CASCADE] == PASS
env[@parameters_key] = old_params
else
return result
end
end

Expand Down

0 comments on commit 3490843

Please sign in to comment.