# Elixir association help

**URL:** <https://forum.elixirforum.com/t/elixir-association-help/30794>\
**Category:** Discussions\
**Tags:** phoenix, associations\
**Created:** [April 20, 2020, 10:49pm UTC](https://forum.elixirforum.com/t/elixir-association-help/30794 "2020-04-20T22:49:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![JackMaarek](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jackmaarek/32/18793_2.png) [@JackMaarek](https://forum.elixirforum.com/u/JackMaarek)\
**Post date:** [April 21, 2020, 12:17am UTC](https://forum.elixirforum.com/t/elixir-association-help/30794/3 "2020-04-21T00:17:50Z")

</div>

Thanks for your help mate !

You were right when the params are nested it throws back an error again:

```elixir
Request: POST /api/image
phoenix_1 | ** (exit) an exception was raised:
phoenix_1 | ** (UndefinedFunctionError) function Category.changeset/2 is undefined (module Category is not available)
phoenix_1 | Category.changeset(%ApiApp.Images.Categories{ __meta__ : #Ecto.Schema.Metadata<:built, "category">, id: nil, image: #Ecto.Association.NotLoaded<association :image is not loaded>, inserted_at: nil, name: nil, updated_at: nil}, %{"id" => 1})
phoenix_1 | (ecto 3.4.0) lib/ecto/changeset/relation.ex:126: Ecto.Changeset.Relation.do_cast/6
phoenix_1 | (ecto 3.4.0) lib/ecto/changeset/relation.ex:315: Ecto.Changeset.Relation.single_change/5
phoenix_1 | (ecto 3.4.0) lib/ecto/changeset/relation.ex:110: Ecto.Changeset.Relation.cast/5
phoenix_1 | (ecto 3.4.0) lib/ecto/changeset.ex:785: Ecto.Changeset.cast_relation/4
phoenix_1 | (api_app 0.1.0) lib/api_app/images.ex:248: ApiApp.Images.create_image/1
phoenix_1 | (api_app 0.1.0) lib/api_app_web/controllers/image_controller.ex:15: ApiAppWeb.ImageController.create/2
phoenix_1 | (api_app 0.1.0) lib/api_app_web/controllers/image_controller.ex:1: ApiAppWeb.ImageController.action/2
phoenix_1 | (api_app 0.1.0) lib/api_app_web/controllers/image_controller.ex:1: ApiAppWeb.ImageController.phoenix_controller_pipeline/2
phoenix_1 | (phoenix 1.4.16) lib/phoenix/router.ex:288: Phoenix.Router. __call__ /2
phoenix_1 | (api_app 0.1.0) lib/api_app_web/endpoint.ex:1: ApiAppWeb.Endpoint.plug_builder_call/2
phoenix_1 | (api_app 0.1.0) lib/api_app_web/endpoint.ex:1: ApiAppWeb.Endpoint.call/2
phoenix_1 | (phoenix 1.4.16) lib/phoenix/endpoint/cowboy2_handler.ex:42: Phoenix.Endpoint.Cowboy2Handler.init/4
phoenix_1 | (cowboy 2.7.0) /backend/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
phoenix_1 | (cowboy 2.7.0) /backend/deps/cowboy/src/cowboy_stream_h.erl:320: :cowboy_stream_h.execute/3
phoenix_1 | (cowboy 2.7.0) /backend/deps/cowboy/src/cowboy_stream_h.erl:302: :cowboy_stream_h.request_process/3
phoenix_1 | (stdlib 3.12) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

```

But I do not understand why as Category.changeset is defined in my schema…

---

_[View the full topic](https://forum.elixirforum.com/t/elixir-association-help/30794)._
