controller
controller copied to clipboard
When configuration public directory isn't set, fallback to default value
https://github.com/hanami/hanami-2-application-template/commit/9a23a1b331dc0ee7629099d0d6320a3f341e4885 crashes when I try to run the specs:
The current implementation of Hanami::Action::Configuration#public_directory is:
def public_directory
root_directory.join(super).to_s
end
For the App Template super returns nil, which makes the Pathname#join (root_directory is an instance of Pathname) to crash.
This fix aims to fallback to the default value if super returns nil.
EDIT: ⚠️ I'm not sure this is the right approach. Given the default value is assigned via dry-configurable, I would have expected super to return the default value, instead of nil.
If you set if to nil dry-configurable will return nil even if there's a default as it assumes that was intentional (IIRC - has been a while since I delved into ts code). ~~Can you share a sample where this became an issue?~~ (RTFMessage, mereghost).
I've removed the assignment and everything works as expected. I'll see if I spot anything weird on the template.
For the App Template super returns nil.
Where is it set on the App Template? I looked into both the App Template and Hanami itself, and I couldn't find it.