
48: Ecto Associations with Sheharyar Naseer
Thinking Elixir Podcast
00:00
How to Set Defaults on the Associations in an Ecto Scheme
Eco has a default option on fields, where you can specify the default value to populate a struct when it's being created. ecto also supports passing it to associations and even joint tables. Default option can also accept an emefitope, which is a top with a module functionaan argument. The drawback is that you can't look at the payent records, attributes or run any custom logic - but this lets you do that.
Transcript
Play full episode