@@ -1197,16 +1197,7 @@ defmodule Ecto.Changeset do
11971197
11981198 """
11991199 @ spec cast_assoc ( t , atom , Keyword . t ( ) ) :: t
1200- def cast_assoc ( changeset , name , opts \\ [ ] )
1201-
1202- def cast_assoc ( % Changeset { data: % { } = data } , _name , _opts )
1203- when not is_map_key ( data , :__meta__ ) do
1204- raise ArgumentError ,
1205- "cast_assoc/3 cannot be used to cast associations into embedded schemas or schemaless changesets. " <>
1206- "Please modify the association independently."
1207- end
1208-
1209- def cast_assoc ( changeset , name , opts ) when is_atom ( name ) do
1200+ def cast_assoc ( changeset , name , opts \\ [ ] ) when is_atom ( name ) do
12101201 cast_relation ( :assoc , changeset , name , opts )
12111202 end
12121203
@@ -2104,16 +2095,7 @@ defmodule Ecto.Changeset do
21042095
21052096 """
21062097 @ spec put_assoc ( t , atom , term , Keyword . t ( ) ) :: t
2107- def put_assoc ( changeset , name , value , opts \\ [ ] )
2108-
2109- def put_assoc ( % Changeset { data: % { } = data } , _name , _value , _opts )
2110- when not is_map_key ( data , :__meta__ ) do
2111- raise ArgumentError ,
2112- "put_assoc/4 cannot be used to put associations into embedded schemas or schemaless changesets. " <>
2113- "Please modify the association independently."
2114- end
2115-
2116- def put_assoc ( % Changeset { } = changeset , name , value , opts ) do
2098+ def put_assoc ( % Changeset { } = changeset , name , value , opts \\ [ ] ) do
21172099 put_relation ( :assoc , changeset , name , value , opts )
21182100 end
21192101
0 commit comments