wlminimal

wlminimal

Need a Help with Nested Resources

Hello!.
I am trying to add Nested Resources in router.ex like this..

resources "/phonebooks", PhonebookController do
  resources "/people", PersonController, except: [:index]
end

and added, templates(using phonebook_person_path() ) and controller

and then I did mix phx.routes to see, but it doesn’t compile. it says,

== Compilation error in file lib/mmarketing_web/views/dashboard/person_view.ex ==
** (CompileError) lib/mmarketing_web/templates/dashboard/person/new.html.eex:3: undefined function phonebook_person_path/2

Please tell me what I am missing :frowning:

Thank you!

Marked As Solved

NobbZ

NobbZ

I checked on my own (just added the provided snippet in a routes file of mine) and pluralisation seems to work fine.

Then I took a closer look at the error message and have seen, that it is called with only 2 arguments, but it needs 4.

  1. the conn or endpoint
  2. the action
  3. the phonebook_id
  4. the id

Also Liked

NobbZ

NobbZ

What’s the output of mix phx.routes?

wlminimal

wlminimal

Thanks! it compiles!
I i didn’t know I had to pass 2 more arguments including conn, and action.

Where Next?

Popular in Questions Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement