Ruby on Rails Monday, January 3, 2011

As per the Rails 3 I18N documentation, I wrote in my routes.rb

scope "(/:locale)", :locale => /en|nl/ do
resources :users
end
match '/:locale' => 'home#index'
root :to => "home#index"

and in my ApplicationController.rb
before_filter :set_locale
def set_locale
I18n.locale = params[:locale]
end
def self.default_url_options(options={})
{:locale => I18n.locale}
end

but I sill get urls with the locale parameter as if the scope was
ignored ...

http://localhost:3000/users/sign_in?locale=en

I rather should get : http://localhost:3000/en/users/sign_in

( I am using also Devise 1.2...)

what could be wrong ? thanks for your suggestions

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment