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

Support for routes with wildcards #28

Merged
merged 2 commits into from
Nov 26, 2013

Conversation

rsierra
Copy link
Contributor

@rsierra rsierra commented Jul 13, 2013

Support for routes with wildcards like:

get '/*page_path', to:'pages#show', as: :page

When default locale is omitted in routes, default routes can't be translated in first place.

get '/*page_path', to:'pages#show'
get '/en/*page_path', to:'pages#show'

In this case, with the wildcard, the default route will catch all paths for the :en locale. So it should be the last. The translation order is defined by available locales that depends on the application configuration. So it is needed to put in the last place when routes are translated.

Make sure the default locale is translated in last place to avoid
problems with wildcards when default locale is omitted in paths. 
The default routes will catch all paths like wildcard if it is 
translated first.
@enriclluelles enriclluelles merged commit 9ee5f67 into enriclluelles:master Nov 26, 2013
@enriclluelles
Copy link
Owner

Hey.

First of all sorry for being so late. Started a new job and I'm not using the gem anymore, so I haven't been paying much attention to it.

Thanks for you contribution, it's appreciated. I removed the constraints options for the globbed url as different Rails versions interpret it differently and I want the gem to work in all of them. Also, this behaviour is inconsistent even without adding the gem, so there's no point in testing it. (It's related to how a Journey::Path::Pattern object gets transformed to a regexp that the rails router uses to match paths)

Maybe next time you'll want to run the test against all the different gemfiles that the gem uses. You can do that running test_runner

Cheers

@rsierra
Copy link
Contributor Author

rsierra commented Nov 27, 2013

Hi, sorry because I saw the travis notification after the pull request, and I forgot to check the version issue. I don't really remember why I use the constraints in the test :-S. I will use test_runer next time :-).

Thanks for the gem!

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

Successfully merging this pull request may close these issues.

2 participants