-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Documentation about Controller/Router integration is incorrect #427
Comments
I actually feel even more dumb now. The second example in the README of this repo references a Are the README examples outdated, or am I missing something obvious? 😕 |
@weppos Hey Simone, this is a leftover of past WIP implementation. My apologies. The fix is on the way. |
Hi @jodosha!
As you recall, we use only the router and controller. I am currently looking for some examples on how to make it happen. A simplified version of the current code looks like:
The app itself is the following. Note how the controllers where scoped on a specific namespace.
and each action was
There's a number of changed I think we'll have to make. I've noticed all actions are now subclassed from The piece I'm missing is how to initialize a router and connect it so that it resolves the actions. I was able to make this work:
but nothing more than that. The following were tests I made and that's when I discovered the various readme issues:
also
I must be missing something obvious to connect a router get to the corresponding action. 😅 |
That is due to the definition of It can accept two args:
It really depends on what you need. |
Good catch! It was a left over from the various attempts I made to implement a working code from the docs 😅 |
One notable change from That simplified the library: it isn't a loader anymore but only a dispatcher. But there is a way to solve this problem: During the initialization time, for each declared route it gets invoked. Example:
|
OK, thanks. We'll look into it. That's a lot of knowledge that would be nice to have somewhere documented. 😉 |
The
Hanami::Router
integration docs seems to be incorrect. It references two parameters (configuration
andnamespace
) that are not accepted by the current 2.xHanami::Router
version:controller/README.md
Lines 884 to 905 in 2eb8390
I also noticed that, across various docs and README, the route definition is sometimes referenced using the notation
books#show
whereas in other cases isbooks.show
.I wish I could provide a PR to update the docs, but after a few hours of digging into v2 docs and code, I've yet to figure out how to successfully define an action and reference to it in a router without using the fully qualified
to: ClassName.new
notation.The text was updated successfully, but these errors were encountered: