Peske
Hi i am new to phoenix and elixir and i am trying to make a textbox that insert 1 data into database and have some error :
== Compilation error in file lib/zivot_web/controllers/topic_controller.ex ==
** (KeyError) key :otp_app not found in: []
(elixir) lib/keyword.ex:389: Keyword.fetch!/2
lib/ecto/repo/supervisor.ex:62: Ecto.Repo.Supervisor.compile_config/2
lib/zivot_web/controllers/topic_controller.ex:3: (module)
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:208: anonymous fn/4 in Kernel.ParallelCompiler.sp
repo.ex:
defmodule Zivot.Repo do
use Ecto.Repo,
otp_app: :zivot,
adapter: Ecto.Adapters.Postgres
end
tabela.ex
defmodule Zivot.Tabela do
use Ecto.Schema
import Ecto.Changeset
schema "topics" do
field :topic, :string
timestamps()
end
@doc false
# def changeset(struct, params) do
# struct
# |> cast(params, [:topic])
# |> validate_required([:topic])
# end
end
defmodule ZivotWeb.Tabela do
use Ecto.Schema
import Ecto.Changeset
def changeset(struct, params) do
struct
|> cast(params, [:topic])
|> validate_required([:topic])
end
end
defmodule ZivotWeb.TopicController do
use ZivotWeb, :controller
use Ecto.Repo
alias Zivot.Tabela
def new(conn, params) do
struct = %Tabela{}
params = %{}
changeset = ZivotWeb.Tabela.changeset(struct,params)
render conn, "new.html", changeset: changeset
end
# def create(conn, %{"tabela" => topic_params}) do
# changeset = ZivotWeb.Tabela.changeset(%Tabela{}, topic_params)
# case Repo.insert(changeset) do
# {:ok, post} ->
#conn
# |> put_flash(:info, "Topic created")
# |> redirect(to: Routes.topic_path(conn, :index))
# {:error, changeset} ->
# render conn, "new.html", changeset: changeset
# end
#end
end
new.html
<%= form_for @changeset, Routes.topic_path(@conn, :create), fn f -> %>
<%= text_input f, :topic %>
<%= submit "Save Topic" %>
<% end %>
Trending in Questions
Hi all,
I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
Background
When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error:
* assembling mark...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New
When I use Mix.install with a git dependency, using git@github.com:... how do I change the SSH identity used?
I’ve got two Github accoun...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #elixirconf-eu
- #processes
- #security
- #api
- #forms
- #performance










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
When ever you
use Ecto.Repo, you must provide the:otp_appoption.kokolegorille
Some files are misplaced…
This file does not belongs to the Web part, it belongs to Zivot part.
This file has no changeset, or commented, why?
And there is no context.
Can You provide the Phoenix version and the way You created the table?
There are generators that might help You building the application if You are a newcomer
For example…