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
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
I would like to know what is the best IDE for elixir development?
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
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
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
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
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
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
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









