existing atoms
I tried your library, thank you for developing it, looks interesting.
One issue i found is that sometimes String.to_existing_atom will fail and we would loose some keys, i think we need to handle this case in rescue block, for example as String.to_atom
This should not be possible as atoms are never garbage collected by the Erlang VM.
The best way to use better_params is to use atom literals in the codebase, which ensure that those params are atomized. E.g.:
params.id
# or
params[:some][:nested][:value]
# instead of
params[:"dynamic_#{key}"]
Can you provide more details about your Elixir & Erlang version, OS, and ideally an MCVE so I can try to reduce it?
Hello sheharyarn, I just meet the same problem.
I write a POST API with nested params in body params. When send request, it lost params casually inside nested struct. I replaced to_existing_atom by to_atom, it solved.