comfortable-mexican-sofa icon indicating copy to clipboard operation
comfortable-mexican-sofa copied to clipboard

'around action' breaking admin CMS

Open echan00 opened this issue 4 years ago • 1 comments

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

echan00 avatar Mar 26 '20 06:03 echan00

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.

nitsujri avatar Apr 17 '20 04:04 nitsujri