belgelenen değil Bu (hiçbir karşılık gelen görünümü, yalnızca varsayılan bir tane ile birlikte) Söz konusu kontrolör eylemi:Phoenix Framework: tanımsız işlev LetsPlan.Event.fetch/2. Ama getirme işlevi yerde
[error] #PID<0.633.0> running LetsPlan.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /events/Evv_YCX71c
** (exit) an exception was raised:
** (UndefinedFunctionError) undefined function LetsPlan.Event.fetch/2
(lets_plan) LetsPlan.Event.fetch(%{__meta__: #Ecto.Schema.Metadata<:loaded>, __struct__: LetsPlan.Event, conn: [...snip...] :conn)
(phoenix_html) lib/phoenix_html/engine.ex:92: Phoenix.HTML.Engine.fetch_assign/2
(lets_plan) web/templates/layout/app.html.eex:11: LetsPlan.LayoutView."app.html"/1
(phoenix) lib/phoenix/view.ex:344: Phoenix.View.render_to_iodata/3
(phoenix) lib/phoenix/controller.ex:633: Phoenix.Controller.do_render/4
(lets_plan) web/controllers/event_controller.ex:1: LetsPlan.EventController.action/2
(lets_plan) web/controllers/event_controller.ex:1: LetsPlan.EventController.phoenix_controller_pipeline/2
(lets_plan) lib/phoenix/router.ex:261: LetsPlan.Router.dispatch/2
(lets_plan) web/router.ex:1: LetsPlan.Router.do_call/2
(lets_plan) lib/lets_plan/endpoint.ex:1: LetsPlan.Endpoint.phoenix_pipeline/1
(lets_plan) lib/plug/debugger.ex:93: LetsPlan.Endpoint."call (overridable 3)"/2
(lets_plan) lib/phoenix/endpoint/render_errors.ex:34: LetsPlan.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
Bu fetch/2
fonksiyonu:
def show(conn, %{"id" => id}) do
event = Repo.get_by!(Event, slug: id)
render conn, "show.html", event
end
Phoenix ile başarısız hiçbir yerde belgelenmez ve kodum asla arama yapmaz!
Vay, bu benim tarafımdan aptaldı. Açıklama için teşekkürler! – rubik