Allow passing in controller#62
Conversation
|
I was thinking about that @scottbarrow. If @julianrubisch is onboard with this overall approach, then it'd be a simple change to make to def controller(signed_controller:)
return default_controller unless signed_controller.present?
message_verifier
.verify(signed_controller)
.yield_self { |controller_string| Kernel.const_get(controller_string) }
end
def default_controller
Futurism.default_controller || ::ApplicationController
end |
|
Congrats folks, somehow @rickychilcott read my mind while I was pondering this while running errands. Uncanny! I‘m all in for an overridable default controller! |
2d33d9e to
f6cb4bc
Compare
julianrubisch
left a comment
There was a problem hiding this comment.
I think this all looks great, only had 2 minor questions.
I'll put this through its paces on Monday and test it on a real project 👍
5cb55a1 to
8cb6134
Compare
Please do. I made some more changes after this review. If you don't mind either building or writing up some quick directions on Monday on how to test this gem in a real app, that'd be helpful. I know how to point my Gemfile to a local gem, but not clear on how to do that with yarn. It'd be good to have a dummy app in this repo or elsewhere to more easily test. Thanks and have a great weekend! |
|
Regarding testing your local version against a real app: use As for a test app, the stimulus_reflex_harness has a futurism branch (thanks @leastbad): https://github.com/leastbad/stimulus_reflex_harness/tree/futurism |
|
Thanks for the hints about testing locally, @julianrubisch. I was able to test this PR using my FuturismAuthSpike project with both setting Thanks for building out the test harness @leastbad. Unfortunately, the branch is referencing old syntax, so it was a bit easier to use my own project. @julianrubisch would you like to have a purpose-built test harness for futurism so that it makes future testing easier? My hope would be to exercise many of the functions and be able to make PR review faster. Ideally, it would also have minimal dependencies (i.e. using sqlite3 and the async adapter locally) to facilitate even faster testing and setup. If that's the case, I can re-work my auth project to be a bit more generic or bring @leastbad's into line. |
|
I'd love to see a Futurism-specific test app with minimal dependencies. I have a feeling that you'd do an awesome job. |
@rickychilcott that would certainly be awesome! Maybe I can also set heroku review apps up for this... |
|
Cherry picked 5820988 into master |
|
👏 |
Enhancement
Description
Optionally allow passing in the controller to use to render the partials.
Fixes #54
Why should this be added
This allows specifying the Controller to be used to render partials which will allow controller specific methods and behaviors to be available in the partial rendering.
Checklist