title: How to use custom preload function after insert?
body: <p>How to use custom model function to preload selected data after <code>Repo.insert</code>? I won't duplicate code from model in controller.</p>
  
  <p>In Post Model:</p>
  
  <pre><code>def preload_all(query) do
    tags = from(t in Tag, select: %{id: t.id, value: t.id})
    from b in query, preload: [:user, tags: ^tags]
  end
  </code></pre>
  
  <p>In Controller:</p>
  
  <pre><code>case Repo.insert(changeset) do
    {:ok, post} -&gt;
      # post = post |&gt; Post.preload_all
      post = Repo.preload(post, [:user, :tags])
  end
  </code></pre>