Problem with routes

Hi!

I’ve got small problem with routes and globalize plugin.
Here’s my routes.rb file:

map.connect ‘:locale/:controller/:action/:id’
map.connect ‘’, :controller => ‘product’, :action => ‘index’
map.connect ‘admin’, :controller => ‘admin/products’, :action => ‘index’
map.connect ‘:controller/:action/:id’

When i go to url:
http://localhost:3000/admin
i get:
http://localhost:3000/en/admin/admin/products

There’s no routing error and the page is correctly displayed. But why
there’s ‘admin’ group twice in the url? When i remove one it still
works.

Could it be caused by this method?
class ApplicationController < ActionController::Base
before_filter :set_locale
def set_locale
if !params[:locale].nil? && LOCALES.keys.include?(params[:locale])
Locale.set LOCALES[params[:locale]]
else
redirect_to params.merge( ‘locale’ => Locale.base_language.code )
end
end
end

Thanks in advance

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs