Skip to content

Commit

Permalink
Clarify when association needs to be preloaded for cast/put_assoc
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmuskala committed Jan 8, 2017
1 parent cdf4cf4 commit c69af56
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ecto/changeset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,10 @@ defmodule Ecto.Changeset do
@doc """
Casts the given association with the changeset parameters.
This function requires the association to have been
When updating the data, this function requires the association to have been
preloaded in the changeset struct. Missing data will
invoke the `:on_replace` behaviour defined on the association.
Preloading is not necessary for newly built structs.
The parameters for the given association will be retrieved
from `changeset.params`. Those parameters are expected to be
Expand Down Expand Up @@ -990,9 +991,10 @@ defmodule Ecto.Changeset do
@doc """
Puts the given association as a change in the changeset.
This function requires the association to have been
When updating the data, this function requires the association to have been
preloaded in the changeset struct. Missing data will
invoke the `:on_replace` behaviour defined on the association.
Preloading is not necessary for newly built structs.
The given value may either be the association struct, a
changeset for the given association or a map or keyword
Expand Down

0 comments on commit c69af56

Please sign in to comment.