Best way to render unloaded view

I am still very new to Phoenix I was wondering what is the best way to not return the unloaded assoc attribute in the view

for example a view of user
{
id: user.id
title: user.title
role: user.role // unloaded assoc
}
and the view will automatic correct it self without throwing exception and return
{
id: user.id
title: user.title
}