-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce base_controller_class config option #67
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition, thank you! I'll do a thorough second review, merge and push a release later this weekend. But looks good on first review.
Excellent! In particular I wasn't sure if you'd prefer a method for reading this value, so let me know if you'd want that change. |
@fractaledmind are there any changes you'd like me to make on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few suggestions.
@@ -7,6 +7,7 @@ | |||
|
|||
module SolidErrors | |||
mattr_accessor :connects_to | |||
mattr_accessor :base_controller_class, default: "::ActionController::Base" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency we can remove the default here and have it in a getter method as below:
mattr_accessor :base_controller_class, default: "::ActionController::Base" | |
mattr_accessor :base_controller_class |
|
||
def test_default_base_controller | ||
assert_equal ActionController::Base, SolidErrors::ApplicationController.superclass | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we're only testing the default Superclass. we could also have test to assert that the custom configured controller is used as expected.
@@ -21,8 +22,6 @@ def username | |||
@username ||= ENV["SOLIDERRORS_USERNAME"] || @@username | |||
end | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def base_controller_class
@base_controller_class ||= @@base_controller_class || ::ActionController::Base
end
Motivation:
It would be nice to use a specific controller from my application as the Solid Errors base controller, the same way that Mission Control Jobs does. For example, if
MyAdminController
handles all of my authentication, it would be nice to simply tell Solid Errors to inherit from that controller.Details:
This PR adds a new
base_controller_class
config option to accomplish this.Please let me know if this is something you'd be willing to add, and if there any other aspects you'd like me to include or change.
And thank you for Solid Errors! Today I upgraded our production app to use Solid Errors ✌🏼