script
I have this struct of preload records.
I want to remove
__meta__ and Ecto.Association.NotLoaded from the main struct as well as from the nested array of preloaded records. To make it a simple map
%Facility{
__meta__: #Ecto.Schema.Metadata<:loaded, "facilities">,
id: 4875,
instance: #Ecto.Association.NotLoaded<association :instance is not loaded>,
name: "Facility",
units: [
%Unit{
__meta__: #Ecto.Schema.Metadata<:loaded, "units">,
facility: #Ecto.Association.NotLoaded<association :facility is not loaded>,
facility_id: 4875,
id: 1593,
name: "Storage",
rooms: #Ecto.Association.NotLoaded<association :rooms is not loaded>
},
%Unit{
__meta__: #Ecto.Schema.Metadata<:loaded, "units">,
cdc_location_class_id: nil,
facility: #Ecto.Association.NotLoaded<association :facility is not loaded>,
facility_id: 4875,
id: 1594,
name: "Storage unit",
rooms: #Ecto.Association.NotLoaded<association :rooms is not loaded>
}
],
users: #Ecto.Association.NotLoaded<association :users is not loaded>
}
Is it possible?
Thanks
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Lightning Talk: Jacob Swanner - Put your Scaller (Named Correctly) | ElixirConf US 2025
https://www.youtube.com/watch?v=dqqZSSxs-MA
Co...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 10 of 11 Posts
idi527
Yes, try writing a recursive function.
kokolegorille
Everything is about transforming data… Another way is to use Enum and Map modules
And Map
script
hey thanks for your input. I have one question is it also possible to add list of maps to a map in a specific order:
Like these two:
When i try to add them the order is reversed. I know its off topic just curious
Can you suggest alternate appraoch?
Thanks
idi527
Add them in the reversed order? I’m not sure what you are doing, though. Where do the maps come from?
script
If i added them in the reverse order then it should be a list. i want it to be a map. Params come from the function. And I want it to manipulate it and add list of items in it like the example above…
NobbZ
This should not reverse anything, could you please be more specific about the problem?
script
Params
|> Map.put(:key, list_of_maps)
The output is
What I want is this:
idi527
These outputs are identical. Try comparing them with
===if you are in doubt.NobbZ
There is no difference in both, those are equivalent from elixirs point of view.
Keys in a map are without any ordering guarantees.
script
Thanks