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

Devise produces authentication unlocalised request without parameter "locale" #145

Closed
modreoci opened this issue Apr 6, 2016 · 3 comments

Comments

@modreoci
Copy link

modreoci commented Apr 6, 2016

devise-i18n (1.0.1)

Started GET "/en/users" for 127.0.0.1 at 2016-04-06 21:28:15 +0200
Processing by UsersController#index as HTML
  Parameters: {"locale"=>"en"}
Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)


Started GET "/users/sign_in" for 127.0.0.1 at 2016-04-06 21:28:15 +0200
Processing by Devise::SessionsController#new as HTML
  Rendered devise/sessions/new.html.erb within layouts/application (4.6ms)
  Rendered layouts/_navigation_links.html.erb (0.4ms)
  Rendered layouts/_nav_links_for_auth.html.erb (1.0ms)
  Rendered layouts/_navigation.html.erb (3.8ms)
  Rendered layouts/_messages.html.erb (0.2ms)
Completed 200 OK in 124ms (Views: 122.7ms | ActiveRecord: 0.0ms)

default locale is set to "sk" and here is the result:
screenshot - 06 04 2016 - 21 30 32
routes.rb

Rails.application.routes.draw do
  scope "(:locale)", locale: /#{I18n.available_locales.join('|')}/ do
    root to: 'visitors#index'
    devise_for :users
    resources :users
    get "/pages/:id" => "high_voltage/pages#show", :as => :page, :format => false
  end
end

part of application.rb

    config.i18n.available_locales = [:en, :sk]
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    config.i18n.default_locale = :sk
@collimarco
Copy link

I have the same issue...

Have you found a solution?

@JasonBarnabe
Copy link
Collaborator

@modreoci Not sure if this is still an issue for you, but in #282 I found that if you use I18n.with_locale then this could happen with the error messages as you describe.

@JasonBarnabe
Copy link
Collaborator

Assuming it is the same issue.

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

3 participants