Hello!
I have 2 schemas: Asset and File.
# asset schema
has_many :files, File
# file schema
belongs_to :asset, Asset
So it looks like:
%Asset{
__meta__: #Ecto.Schema.Metadata<:loaded, "assets">,
id: 1,
name: "name",
files: []
}
Each time i need to update my asset.files (for example: add one file, then add yet 3 files in 10 minutes).
Actually I do not really understand how works put_assoc function, but it not saves old data, it removes data and set new data. Or maybe build_assoc is the only way to handle that?!
Maybe i’m explaining too bad, but it must work like in Rails that command asset.files << new_file






















