DEV Community

Discussion on: Many to Many Relations in Ecto

Collapse
 
juanpabloaj profile image
JuanPablo

thanks for the post.

how can you delete the like_comment relationship?

Collapse
 
ceyhunkerti profile image
Ceyhun Kerti
  def dislike_comment(current_user, comment_id) do
    from(c in CommentLike, where: c.comment_id == ^comment_id and c.user_id == ^current_user.id)
    |> Repo.delete_all
  end
Collapse
 
juanpabloaj profile image
JuanPablo

thanks for the answer

I found a similar option here

elixirforum.com/t/how-to-remove-de...

thanks again :)