@@ -7,7 +7,7 @@ defmodule CodeCorps.CategoryController do
77 plug :load_and_authorize_resource , model: Category , only: [ :create , :update ]
88
99 def index ( conn , _params ) do
10- categories = Category |> Repo . all |> Repo . preload ( [ :project_categories , :projects ] )
10+ categories = Category |> Repo . all |> Repo . preload ( [ :project_categories ] )
1111 render ( conn , "index.json-api" , data: categories )
1212 end
1313
@@ -18,7 +18,7 @@ defmodule CodeCorps.CategoryController do
1818 { :ok , category } ->
1919 category =
2020 category
21- |> Repo . preload ( [ :projects ] )
21+ |> Repo . preload ( [ :project_categories ] )
2222
2323 conn
2424 |> put_status ( :created )
@@ -34,7 +34,7 @@ defmodule CodeCorps.CategoryController do
3434 def show ( conn , % { "id" => id } ) do
3535 category =
3636 Category
37- |> preload ( [ :projects ] )
37+ |> preload ( [ :project_categories ] )
3838 |> Repo . get! ( id )
3939
4040 render ( conn , "show.json-api" , data: category )
@@ -43,7 +43,7 @@ defmodule CodeCorps.CategoryController do
4343 def update ( conn , % { "id" => id , "data" => data = % { "type" => "category" , "attributes" => _category_params } } ) do
4444 changeset =
4545 Category
46- |> preload ( [ :projects ] )
46+ |> preload ( [ :project_categories ] )
4747 |> Repo . get! ( id )
4848 |> Category . changeset ( Params . to_attributes ( data ) )
4949
0 commit comments