Some things are working well, but when trying to create a link with Routes.live_path the following error is displayed. function MyApp.Router.Helpers.live_path/2 is undefined or private.
<%= link('Click", to: Routes.live_path(@socket, MyApp.ModalLive), phx_click: "show-modal") %>
I tried to look for an answer, but I was unsuccessful.
Since I spent a good half hour frustrated by this, I’m adding a comment for others who may find their way here.
I was also getting an undefined or private error for live_path even though I did have a live route. I had generated my project with --live so I knew LV was installed properly.
What I discovered is that if you have defined your live route with an action, like:
live "/", FooLive, :index
Then Routes.live_path will NOT be defined (but Routes.foo_path(socket, :index) will work). It took a long time for me to spot this. Removing the , :index from the router resulted in live_path being defined and operating as the docs outlined!
I managed to resolve the live_path being undefined or private by also removing the , :indexfrom the router, it is subsequently defined.
What I’m trying to do is a live_redirect in a the live.html.leex where I want my navigation to move around pages in my web app. This works with linking to the PageLive generated by Live View generator used to generate the project in the first place – but it does not work with the subsequent Live View i generated for the resource Party. That Live View of course has the actions :index, :new and :edit.
I’m getting no function clause matching in [my project name]Web.PartyLive.Index.apply_action/3.
Most (all?) examples I’ve found do not show how to build up navigation. While I cannot figure out the above and realising that it may not make sense to a Live View pro, could anyone at least provide reference to a more complete example?