Closed Shahidrox closed 5 years ago
I think this has been fixed in master. I started referencing the routes by name instead of hard coding them in the JS helper. The routes should respect any surrounding scope prefix, locale, etc.
I'll be releasing a new version to RubyGems shortly. Please re-open if this does not fix your problem.
Whenever I change language, like -from english to Japanese ,everything works fine.But when I click any of the options on the menu,It gets converted to english again and When I click again on any other options it again gets converted to Japanese.
(1) (2) (3) (4)
routes.rb
scope "(:locale)", locale: /en|ja/ do
devise_for :users, controllers: { sessions: 'users/sessions' }
devise_scope :user do
match 'active' => 'users/sessions#active', via: :get
match 'timeout' => 'users/sessions#timeout', via: :get
end
end
application_controller.rb
before_action :set_locale
auto_session_timeout 30.minutes
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
def default_url_options(options = {})
{ locale: I18n.locale }
end
application.html.erb
<%= auto_session_timeout_js %>
sessions_controller.rb
def active
render_session_status
end
def timeout
flash[:notice] = "Your session has timed out."
redirect_to "/users/sign_in"
end
Problem With this link
Request URL: http://localhost:3000/active
It should be
Request URL: http://localhost:3000/ja/active
orRequest URL: http://localhost:3000/en/active