current_page? does not consider locale #7

Closed
webhoernchen opened this Issue Aug 10, 2010 · 11 comments

Projects

None yet

7 participants

@webhoernchen

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.

@svenfuchs
Owner

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

@webhoernchen

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

@kuroda
Collaborator
kuroda commented Jul 13, 2011

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.

@watson
watson commented Feb 7, 2012

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

@macovsky
macovsky commented Mar 3, 2012

same here: Rails 3.2.1 and routing-filter 0.3.0

@macovsky
macovsky commented Mar 3, 2012

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

@kuroda kuroda was assigned Mar 4, 2012
@kuroda
Collaborator
kuroda commented Mar 4, 2012

@watson, @macovsky

Thanks.

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

@kuroda
Collaborator
kuroda commented Mar 4, 2012

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.

@yabawock
Collaborator
yabawock commented May 8, 2012

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

@corneverbruggen

Using Rails 3.2.2 - this fix solves the problem.

Thanks!

@yabawock
Collaborator

Thanks for the feedback, closing

@yabawock yabawock closed this May 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment