0
mix phoenix.new sandpit
mix ecto.create
mix phoenix.gen.json Part parts name part_of:references:parts
mix ecto.migrate
를 참조하는 모델을 생성하기 때문에
scope "/api", Sandpit do
pipe_through :api
resources "/parts", PartController, except: [:new, :edit]
end
는 다음 서버를 실행하는 경로를 편집하고
http://localhost:4000/api/parts
I에가는 오류가 발생합니다.
info] Running Sandpit.Endpoint with Cowboy using http on port 4000
13 Jul 23:11:37 - info: compiled 5 files into 2 files, copied 3 in 744ms
[info] GET /api/parts
[debug] Processing by Sandpit.PartController.index/2
Parameters: %{}
Pipelines: [:api]
[debug] SELECT p0."id", p0."name", p0."part_of_id", p0."inserted_at", p0."updated_at" FROM "parts" AS p0 [] ERROR query=78.0ms
[info] Sent 500 in 140ms
[error] #PID<0.318.0> running Sandpit.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /api/parts
** (exit) an exception was raised:
** (Postgrex.Error) ERROR (undefined_column): column p0.part_of_id does not exist
(ecto) lib/ecto/adapters/sql.ex:185: Ecto.Adapters.SQL.query!/5
이것은 발전기의 버그입니까? _id
으로 이름을 지정하고 싶거나 숨겨진 "규칙"처럼 보이거나 _id에 추가하지 못했습니다. 자동으로 _id를 추가하지 않으면 생성을 수행하는 동안 오류가 발생하거나 충돌없이 주어진 이름을 사용한다고 생각할 수 있습니다.
mix phoenix.gen.json Thing things name thing_of_id:references:things
으로 시도하고 원인을 오류
을 마이그레이션하거나 뭔가 다른 일이야?
나에게 버그 것 같은데에 대한 참조를 접미사 기억하는 것입니다. 난 당신이 그것을보고하거나 자신의 Google 그룹스 메일 링리스트에 게시해야한다고 생각하지만 (처음에는 'master'브랜치에서 수정되었는지 확인). – Dogbert