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

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
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

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
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
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

We're in Beta

About us Mission Statement