Skip to content

Commit

Permalink
Merge pull request #56 from gauda/master
Browse files Browse the repository at this point in the history
request.path did not work any more
  • Loading branch information
simi committed Sep 1, 2015
2 parents 14761c1 + 844b87b commit d7c2f07
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/routing_filter/adapters/routers/journey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ def find_routes_with_filtering(env)
find_routes_without_filtering(env).map do |match, parameters, route|
[ match, parameters.merge(filter_parameters), route ]
end.tap do |match, parameters, route|
env['PATH_INFO'] = original_path # restore the original path
# restore the original path
if env.is_a?(Hash)
env['PATH_INFO'] = original_path
else
env.path_info = original_path
end
end
end
alias_method_chain :find_routes, :filtering
Expand Down
11 changes: 11 additions & 0 deletions test/rails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,15 @@ def params
assert_equal uuid, params[:uuid]
assert_equal "/en/#{uuid}/foo/1.html", params[:url]
end

test "check request object" do
get "/de/foo/1"
assert_equal "/de/foo/1", last_request.path

get "/foo/1"
assert_equal "/foo/1", last_request.path

get "/de/foo/1?bar=baz"
assert_equal "/de/foo/1?bar=baz", last_request.fullpath
end
end

1 comment on commit d7c2f07

@phlegx
Copy link

@phlegx phlegx commented on d7c2f07 Sep 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR works for me!

Please sign in to comment.