Checking that an association is loaded
Ecto will NOT load associations automatically, that is something that you must do explicitly and sometimes you might expect an association to be loaded but because of the code path travelled, it is not.
You can check to see if an association is loaded with
case Ecto.assoc_loaded?(post.channel) do true -> IO.puts('yep its loaded') false -> IO.puts('you do not have the data') end