andrewb
Undefined function session_path/2
Hi,
I am having trouble debugging an error:
== Compilation error in file lib/booking_central_web/views/session_view.ex ==
** (CompileError) lib/booking_central_web/templates/session/register.html.eex:9: undefined function session_path/2
(stdlib) lists.erl:1338: :lists.foreach/2
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6
Here is my router:
scope "/", BookingCentralWeb do
pipe_through :browser # Use the default browser stack
get "/", DashboardController, :index
get "/login", SessionController, :login_form
get "/register", SessionController, :register_form
post "/register", SessionController, :register_user
end
I have a controller:
defmodule BookingCentralWeb.SessionController do
use BookingCentralWeb, :controller
alias BookingCentral.Accounts.{Registration}
plug :put_layout, "accounts.html"
def login_form(conn, _params) do
render conn, "login.html"
end
def register_form(conn, _params) do
changeset = Registration.changeset(%Registration{})
render conn, "register.html", changeset: changeset
end
def register_user(conn, %{"registration_params" => params}) do
IO.inspect params
render conn, "login.html"
end
end
Here is my View:
defmodule BookingCentralWeb.SessionView do
use BookingCentralWeb, :view
end
And I am referencing the session_path in my form:
<%= form_for @changeset, session_path(@conn, :register_user), fn f -> %>
Any suggestions for working out why I get this error are appreciated.
Andrew
Marked As Solved
sanswork
Also Liked
sanswork
get "/login", SessionController, :login_form
get "/register", SessionController, :register_form
post "/register", SessionController, :register_user
All three of those should define session_path in 1.3
1
andrewb
Last Post!
andrewb
Popular in Questions
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
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
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Other popular topics
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
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
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
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
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









