Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong url generation with scope declared #59

Closed
aboutlo opened this issue Jan 4, 2013 · 7 comments
Closed

wrong url generation with scope declared #59

aboutlo opened this issue Jan 4, 2013 · 7 comments

Comments

@aboutlo
Copy link

aboutlo commented Jan 4, 2013

define a route like that:

scope "/(:locale)" do
match "/*id" => 'high_voltage/pages#show', :as => :page, :format => false
end

create a link with this helper:
page_path("about")

you get:
No route matches {:controller=>"high_voltage/pages", :action=>"show", :locale=>"about"}

rather using page_path(:id => "about") it works fine and you get "/locale/tour"

@harlow
Copy link
Contributor

harlow commented Jan 4, 2013

Hi @aboutlo thanks for the feedback. Will take a look into this over the next few days.

@harlow
Copy link
Contributor

harlow commented Jan 6, 2013

@aboutlo can you walk me through what you're trying to do here? Where are you storing the static pages with translations?

@aboutlo
Copy link
Author

aboutlo commented Jan 6, 2013

I am storing my pages directly to /app/views/mypage.html.erb without any content_path prefix configured.
My goal is handle default contents with URLs like http://www.mydomain.com/mypage and localized contents with URLs like http://www.mydomain.com/:locale/mypage

@harlow
Copy link
Contributor

harlow commented Jan 7, 2013

Cool, that approach makes sense.

I mocked up a test application using I18n support and was able to replicate the issue. As you mentioned page_path(id: 'about') works.

I will continue to look into a solution that will allow us to remove id, for the time being this seems to be the only way to get high_voltage to work with locales.

@jmuheim
Copy link

jmuheim commented Jul 21, 2014

Any news on this?

@harlow
Copy link
Contributor

harlow commented Jul 23, 2014

@jmuheim no luck just yet. Its unclear to me how we're going to fix this one. I suppose we could try to override the page_path method using a view helper and then have that delegate to the Rails routing method.

@notrab
Copy link

notrab commented Dec 3, 2015

How are we getting on with this?

Also, should I be experiencing issues linking to nested pages?

E.g.

link_to "Privacy Policy", page_path(id: 'legal/privacy-policy')

Doesn't understand the / only when using the id: setter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants