Skip to content
Mitsuhiro Shibuya edited this page Oct 7, 2021 · 1 revision

Creating a separate controller (inherit from ActionController::Base not ApplicationController) with I18n logic and inherit rails_admin controller from it in a config file will do the job.

class RailsAdminAbstractController < ActionController::Base
  around_action :switch_locale

  private

  def switch_locale(&action)
    I18n.with_locale(:en, &action) # or anything you like
  end
end

config/initializers/rails_admin.rb

...
RailsAdmin.config do |config|
  ...
  config.parent_controller = '::RailsAdminAbstractController'
  ...

See also this and never forget about this.

Clone this wiki locally