How to dynamically cast and validate embedded Ecto schemas based on a field type in Elixir?
I have an Elixir application using Ecto, and I need to dynamically cast and validate embedded schemas based on a type field. My Discount schema has a field discount_params that can be different structures depending on the value of the type field.
How can I pass variables to an elixir/ecto subquery?
I have this query in ecto below: