mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Fix MFA usage in cast_assoc (#267)
This commit is contained in:
parent
80f9fa9352
commit
e6c7651d5d
2 changed files with 2 additions and 2 deletions
|
@ -57,7 +57,7 @@ defmodule Philomena.Conversations.Conversation do
|
||||||
|> put_recipient()
|
|> put_recipient()
|
||||||
|> set_slug()
|
|> set_slug()
|
||||||
|> set_last_message()
|
|> set_last_message()
|
||||||
|> cast_assoc(:messages, with: {Message, :creation_changeset, [from]})
|
|> cast_assoc(:messages, with: &Message.creation_changeset(&1, &2, from))
|
||||||
|> validate_length(:messages, is: 1)
|
|> validate_length(:messages, is: 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ defmodule Philomena.Topics.Topic do
|
||||||
|> change(forum: forum, user: attribution[:user])
|
|> change(forum: forum, user: attribution[:user])
|
||||||
|> validate_required(:forum)
|
|> validate_required(:forum)
|
||||||
|> cast_assoc(:poll, with: &Poll.update_changeset/2)
|
|> cast_assoc(:poll, with: &Poll.update_changeset/2)
|
||||||
|> cast_assoc(:posts, with: {Post, :topic_creation_changeset, [attribution, anonymous?]})
|
|> cast_assoc(:posts, with: &Post.topic_creation_changeset(&1, &2, attribution, anonymous?))
|
||||||
|> validate_length(:posts, is: 1)
|
|> validate_length(:posts, is: 1)
|
||||||
|> unique_constraint(:slug, name: :index_topics_on_forum_id_and_slug)
|
|> unique_constraint(:slug, name: :index_topics_on_forum_id_and_slug)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue