<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="112491" data-post-id="112491">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jdumont" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jdumont/120/2353_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jdumont
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="5" data-topic="12159">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>But generally speaking, decoupling your forms (UI representation) from your DB representation is a very good practice.</p>
</blockquote>
</aside>
<p>Slight tangent, but I think that much of the material online (both docs and tutorials) suggests that Phoenix forms is the “right” way. Of course you can structure your forms however you wish, but I think coupling is implicitly encouraged. You certainly give up a lot of wonderful developer ux when you decouple them from the DB, and it adds friction to the correct choice. I certainly doubted myself whenever I strayed from them in the early days.</p>
<p>Could this be an area like Phoenix pre-Contexts, where the encouraged behaviour is actually something on an anti-pattern? Perhaps much like the generators, Phoenix Forms need a disclaimer: <em>“These are great for simple use care X, but not so great for more complicated use case Y.”</em></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="112491" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/updating-an-embedded-schema-general-problems-understanding-ecto/12159/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-112491" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="112491"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="112494" data-post-id="112494">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="LostKobrakai" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/LostKobrakai/120/3072_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  LostKobrakai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Phoenix forms are certainly the right way. Also using ecto with phoenix forms is not an issue. But for any non trivial form it’s often better (and imho easier) to have a schema/changeset or schemaless changeset special to your form’s needs and not to use the db schema directly. Or the usual example of user registration: You might have one form in the frontend, but create an user login and a profile in the backend. It’s a really nice pattern to decouple that and the only thing I not really like about it right now it consolidating the errors of the db schemas, so they’re shown in the form again. All the field mapping can become tricky.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="112494" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/updating-an-embedded-schema-general-problems-understanding-ecto/12159/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-112494" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="112494"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="112501" data-post-id="112501">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jdumont" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jdumont/120/2353_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jdumont
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="LostKobrakai" data-post="13" data-topic="12159">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>But for any non trivial form it’s often better (and imho easier) to have a schema/changeset or schemaless changeset special to your form’s needs and not to use the db schema directly.</p>
</blockquote>
</aside>
<p>Agreed, it was this transition from nested forms that I always struggled to make.</p>
<aside class="quote no-group" data-username="LostKobrakai" data-post="13" data-topic="12159">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>All the field mapping can become tricky.</p>
</blockquote>
</aside>
<p>This. Getting nice errors back out to the form is a perfect example of where the developer suddenly becomes more complex.</p>
<p>Another tangent: It’s also interesting to see what I was struggling with this time last year.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="112501" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/updating-an-embedded-schema-general-problems-understanding-ecto/12159/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-112501" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="112501"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>