Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] embeds_many doesn't seem to be supported #131

Open
jney opened this issue Jul 21, 2020 · 1 comment
Open

[BUG] embeds_many doesn't seem to be supported #131

jney opened this issue Jul 21, 2020 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jney
Copy link

jney commented Jul 21, 2020

Versions Used
Kaffy: 0.9.0 and 0.8.1
Phoenix: 1.4.17
Elixir: 1.10.4

What's actually happening?

using embeds_many:

  schema "companies" do
    field :name, :string
    embeds_many :addresses, Myapp.Address, on_replace: :delete
    timestamps()
  end

  @doc false
  def changeset(company, attrs) do
    company
    |> cast(attrs, [:name])
    |> cast_embed(:addresses)
    |> validate_required([:name])
  end
end

raises the following error:

    ** (FunctionClauseError) no function clause matching in Ecto.Changeset.change/2
        (ecto 3.4.5) lib/ecto/changeset.ex:366: Ecto.Changeset.change([], %{})
        (kaffy 0.9.0) lib/kaffy/resource_form.ex:84: Kaffy.ResourceForm.build_html_input/6
        (kaffy 0.9.0) lib/kaffy/resource_form.ex:336: Kaffy.ResourceForm.kaffy_input/5
        (kaffy 0.9.0) lib/kaffy_web/templates/resource/new.html.eex:20: anonymous fn/4 in KaffyWeb.ResourceView."new.html"/1
        (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
        (kaffy 0.9.0) lib/kaffy_web/templates/resource/new.html.eex:18: KaffyWeb.ResourceView."new.html"/1
        (kaffy 0.9.0) lib/kaffy_web/templates/layout/app.html.eex:141: KaffyWeb.LayoutView."app.html"/1
        (phoenix 1.4.17) lib/phoenix/view.ex:410: Phoenix.View.render_to_iodata/3
        (phoenix 1.4.17) lib/phoenix/controller.ex:776: Phoenix.Controller.__put_render__/5
        (phoenix 1.4.17) lib/phoenix/controller.ex:792: Phoenix.Controller.instrument_render_and_send/4
        (kaffy 0.9.0) lib/kaffy_web/controllers/resource_controller.ex:1: KaffyWeb.ResourceController.action/2
        (kaffy 0.9.0) lib/kaffy_web/controllers/resource_controller.ex:1: KaffyWeb.ResourceController.phoenix_controller_pipeline/2
        (phoenix 1.4.17) lib/phoenix/router.ex:288: Phoenix.Router.__call__/2
        (myapp 0.1.0) lib/myapp_web/endpoint.ex:1: DewWeb.Endpoint.plug_builder_call/2
        (myapp 0.1.0) lib/plug/debugger.ex:132: DewWeb.Endpoint."call (overridable 3)"/2
        (myapp 0.1.0) lib/myapp_web/endpoint.ex:1: DewWeb.Endpoint.call/2
        (phoenix 1.4.17) lib/phoenix/endpoint/cowboy2_handler.ex:42: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.8.0) /Users/jney/src/myapp/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.8.0) /Users/jney/src/myapp/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
        (cowboy 2.8.0) /Users/jney/src/myapp/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3

What should happen instead?

it should open the form

@jney jney added the bug Something isn't working label Jul 21, 2020
@aesmail aesmail added this to the v0.9.1 milestone Jul 22, 2020
@aesmail aesmail modified the milestones: v0.9.1, v0.10.0 Nov 4, 2021
@Anonyfox
Copy link

looks like not working still 3 years later - can confirm its crashing with 0.10.3.

thats unfortunate, I do have quite a lot of embeds_many columns on my tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants