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

'around action' breaking admin CMS #910

Open
echan00 opened this issue Mar 26, 2020 · 1 comment
Open

'around action' breaking admin CMS #910

echan00 opened this issue Mar 26, 2020 · 1 comment

Comments

@echan00
Copy link

echan00 commented Mar 26, 2020

My application controller has an 'around_action' call to change the locale, but it is breaking the admin cms and keeping the page from rendering, any idea why this is a problem?

class ApplicationController < ActionController::Base
around_action :set_locale

def set_locale(&action)
  I18n.with_locale(params[:lang1], &action)
end
..
end
@nitsujri
Copy link
Contributor

Late to the party, but out of curiosity, why not set it in general as in I18n.locale = params[:lang1]?

I've personally had difficulties with full request around_actions for setting time zone and locales as you've noticed here. It also messes with the stack trace making debugging difficult in instances.

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

2 participants