You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an error that seems to be related to custom authentication and short-circuit rendering:
ActionView::Template::Error (undefined method 'servers' for nil)
Information for cause: ActionView::Template::Error (undefined method 'servers' for nil):
1: <% if application.servers.many? %>
2: <div class="server-selector navbar-item">
3: <div class="tabs is-toggle is-toggle-rounded is-small">
4: <ul>
app/lib/authentication.rb:20:in 'Authentication#require_login'
I am using a non-default base_controller_class, which has a before_action hook for authentication. It will render a login form if the user is not authenticated. Here is app/lib/authentication.rb:20:
I believe that the Mission Control layout is still being rendered, which is rendering the application selection partial, but application.servers has not been set.
I'm not sure about the best way to handle this. Is this something I should be overriding in my application, or should it be fixed in Mission Control itself? Perhaps the Mission Control layout should also be set in a before_action, so that the parent controller hooks run first, before the layout has been changed? Should the application being referenced in the partial be initialized in a different way?
I'm happy to contribute a PR but would like some guidance around the desired approach. Thanks.
The text was updated successfully, but these errors were encountered:
christopher-b
changed the title
Error: "undefined method 'servers' for nil" when using non-default controller with authentication
Error when rendering in a before_action hook
Jan 21, 2025
I'm encountering an error that seems to be related to custom authentication and short-circuit rendering:
I am using a non-default
base_controller_class
, which has abefore_action
hook for authentication. It will render a login form if the user is not authenticated. Here is app/lib/authentication.rb:20:I believe that the Mission Control layout is still being rendered, which is rendering the application selection partial, but
application.servers
has not been set.I'm not sure about the best way to handle this. Is this something I should be overriding in my application, or should it be fixed in Mission Control itself? Perhaps the Mission Control layout should also be set in a
before_action
, so that the parent controller hooks run first, before the layout has been changed? Should theapplication
being referenced in the partial be initialized in a different way?I'm happy to contribute a PR but would like some guidance around the desired approach. Thanks.
The text was updated successfully, but these errors were encountered: