Discourse Plugins and Rails 6 config/initializers Question

What I did recently, not yet a super expert like many of you in building a Rails apps, is to plan which configuration variables should reload without restarting Rails, and I move that code to the ApplicationController.

I am sure there are better ways to do this, but since this particular Rails implementation is a back-office app and performance is not an issue:

class ApplicationController < ActionController::Base

  before_action  :set_site_settings

  private

  def set_site_settings
    @use_custom_date_format = Sitesetting.where(name: "custom_date_format").pluck(:value).last
  end

end

I will be happy when I find a better way to do this!

However, moving this out of the Rails initializers means the user can change this site setting easily because it is now in the DB using a basic Rails MVC CRUD scaffold.

Since SQL caching in Rails does not work outside the scope of an action, someday I need to learn how to move this to cache and make sure that the cache clears when the Rails controller processes the action (for example, save a new value in the site settings controller, etc.)

Anyway, this client Rails app (back-office only) is not for high performance use, so adding the query to the application controller works OK and saves me from repeating this code in each controller in the project where that site setting is required.