@fireside68, Thank you for your reply.
However the files
embedded schema does not have a name. I updated it to:
embedded_schema do
field(:url, :string)
field(:filename, :string)
field(:type, :string)
field(:size, :integer)
field(:duration, :integer)
belongs_to :platforms, Platform, on_replace: :delete
end
Considering your suggestion for the platforms naming I also followed but had the same result:
** (ArgumentError) schema Media.PostgreSQL.Schema does not have association :files
I also referred to this issue also to this PR.
So I concluded the following:
You can preload directly from the embedded schema it self, in my case the file
schema. However I can not
preload what’s inside the embedded schema when querying the parent schema in my case the media
schema that holds the embedded schema files
.
The error stating there is no association is quite correct as media does not have an association with files
. However files
does have an association with platforms
but cannot be preloaded when querying the medias
.
I am not sure if this feature is covered or not to preload nested association within embeds directly.