Changing default path for layouts

I’ve combed over the api, the classes, and even the file itself and I
can’t seem to figure it out.

The closest line I can find that shows a relevant area of the layout I
wish to change is undocumented in layout.rb of action_controller:

def layout_list #:nodoc:
Array(view_paths).sum([]) { |path| Dir["#{path.to_str}/layouts/**/*"]
}
end

All starting layouts are pointing to app/views/layouts/**/*

I wish to point the initial starting point to:

public/themes/**/*

I already have my layouts being decided based off model values within an
options set. I can easily point it to any new layout within the themes
folder but the starting point is wrong.

How do I change this from the default starting point to the new starting
point?

For clarification,

If I try to go to a page on my site which has the correct (route to the
layout), I receive this error:

Missing layout public/themes/default/layouts/application.erb in view
path app/views

So, the public/themes/default/layouts/application.erb is correct but the
starting path of app/views is not.

I want the starting path to be changed from app/views to public/themes
(but only for layouts), not for templates.

Okay, I managed to figure it out but I’m not sure it’s the best way of
doing it. I placed the following code in environment.rb:

ActionController::Base.view_paths = [“app/views”, “public/themes”]

So, it looks in both view paths and in app/views there are no layouts
and in public/themes the layouts exist under the theme name. So far,
everything is working great and I don’t see any performance issues.

But, the question is -

Is there a better way to do this?