svenfuchs/routing-filter

current_page? does not consider locale

Closed this issue · 11 comments

Example:

current_page?('/en/my/current/page') returns false even if '/en/my/current/page' is the current url.

current_page?('/my/current/page') returns true.

which version of routing_filter are you talking about? what's your rails version? and how did you set routing_filter up?

I use Rails 3.0.0.rc and routing_filter 0.1.6

Given the following Route-File:
AppName::Application.routes.draw do
filter :locale
...
end

Hi, webhoernchen

With Rails 3.0.9 and routinig_filter 0.2.4, I could not reproduce.

I want to know if you have still this problem.

Hi, I have the exact same issue. I'm running Rails 3.1.3 and routing-filter 0.3.0

same here: Rails 3.2.1 and routing-filter 0.3.0

but on Rails 3.1.3 + routing-filter 0.2.4 it works fine.

@watson, @macovsky

Thanks.

Reproduced on Rails 3.2.2 + routing-filter 0.3.0. Workaround is not yet found, though.

I found the cause of this issue.

The return value of request.path changed between the version 0.2.4 and 0.3.0.

When I get a page with /en/my/current/page on routing-filter 0.2.4, request.path returns /en/my/current/page. But, on routing-filter 0.3.0, it returns /my/current/page.

Because current_page? helper compares the given path and request.path, we get wrong result on 0.3.0.

Unfortunately, I've not found the way to fix it.

Could somebody hitting this issue on Rails 3.2 test the fix? According to my tests routing-filter now behaves the same on Rails 3.1 and 3.2

Using Rails 3.2.2 - this fix solves the problem.

Thanks!

Thanks for the feedback, closing