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.

Last Post!

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

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
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
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
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

Other popular topics Top

New
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
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement