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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/lgp" rel="nofollow">@lgp</a> <img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"></p>
<ul>
<li>keys and id logic is being spread all over utility functions like get_url and handle_response.</li>
</ul>
<p>Check if this works:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule JsonApi do
  def query(cat, id \\ 0, keys \\ []) do
    categories = %{
      "posts"    =&gt; 100,
      "comments" =&gt; 500,
      "albums"   =&gt; 100,
      "photos"   =&gt; 5000,
      "todos"    =&gt; 200,
      "users"    =&gt; 10
    }
    base = "https://jsonplaceholder.typicode.com/"
    
    cond do
      cat not in Map.keys(categories) -&gt;
        {:error, ~s('#{cat}' is not a valid category.)}

      id &gt; categories[cat] -&gt;
        {:error, ~s(The maximum id for '#{cat}' is #{categories[cat]}.)}

      is_list(keys) and length(keys) &gt; 0 -&gt;
        url = [base, cat, "/", to_string(id)]
        response = get_data(url)
        case response do
          {:ok, target} -&gt;
            get_in(target, keys)

          _ -&gt;
            response 
        end

      id &gt; 0 -&gt;
        url = [base, cat, "/", to_string(id)]
        get_data(url)

      true -&gt;
        url = [base, cat]
        get_data(url)
    end
  end

  defp handle_response({:ok, %{status_code: 200, body: body}}) do
    target = Poison.Parser.parse!(body, %{})
    {:ok, target}
  end

  defp handle_response({:ok, %{status_code: status, body: body}}) do
    message =
      body
      |&gt; Poison.Parser.parse!(%{})
      |&gt; get_in(["message"])

    {:error, status, message}
  end

  defp handle_response({:error, reason}), do: {:error, reason}

  defp get_data(url) do
    url
    |&gt; :erlang.iolist_to_binary()
    |&gt; HTTPoison.get()
    |&gt; handle_response()
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="244711" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-244711" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="244711"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
    <div class="postbit" id="244714" data-post-id="244714">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lgp" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lgp
                    <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">
								<p>Much nicer! Thanks!</p>
<ul>
<li>Larry</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="244714" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-244714" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="244714"
                     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="245025" data-post-id="245025">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="drolll" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  drolll
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Personally, I like to paraphrase Thomas Jefferson with “One codes best who codes least”.<br>
While I highly admire and recommend the excellent courses from Pragmatic Studios,  I often wince when coming across code that is unhelpfully verbose or not refactored before put into production.  With a functional language, there is seldom any advantage to the use of if-else or cond clauses IMHO.<br>
Here’s my take:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule JsonAPI do
    @cats %{"posts" =&gt; 100,"comments" =&gt; 500,"albums" =&gt; 100,"photos" =&gt; 5000,"todos" =&gt; 200,"users" =&gt; 10}
    @base "https://jsonplaceholder.typicode.com/"
    
    def query(cat, id, keys). do: check_key(cat) |&gt; chk_range(cat, id) |&gt; re_query(cat, id, keys) 
    def query(cat, id),       do: check_key(cat) |&gt; chk_range(cat, id) |&gt; re_query(cat, id)
    def query(cat),           do: check_key(cat)                       |&gt; re_query(cat)
    
    def check_key(cat),                                      do: check_key(cat, Map.keys(@cats))
    def check_key(cat, cat_keys) when cat in cat_keys,       do: :ok
    def check_key(cat, _ ),                                  do: {:error, "'#{cat}' is not a valid category." }  
    
    def chk_range(:ok, cat, id)  when id &lt;= @cats(cat),      do: :ok
    def chk_range(:ok, cat, _ ),                             do: {:error, "The maximum id for '#{cat}' is #{@cats[cat]}." }
    def chk_range(error, _, _ ),                             do: error
      
    def re_query(:ok, {cat, id, keys}),                      do: lookup(cat, id) |&gt; respond(keys)
    def re_query(:ok, {cat, id      }),                      do: lookup(cat, id) |&gt; respond
    def re_query(:ok, {cat          }),                      do: lookup(cat)     |&gt; respond
    def re_query({:error, msg},  _   ),                      do: msg 
  
    def lookup(cat, id),                                     do: HTTPoison("#{@base}#{cat}/#{to_string(id)}")
    def lookup(cat)    ,                                     do: HTTPoison("#{@base}#{cat}")
    
    def respond( {:ok, %{status_code:  200,   body: b}}, k), do: {:ok,            get_in(Poison.Parser(b, %{}),  k      )}
    def respond( {:ok, %{status_code: status, body: b}}, _), do: {:error, status, get_in(Poison.Parser(b, %{}), ["message"])}
    def respond( {:error, reason }, _ ),                     do: {:error, reason}

    end
...</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245025" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-245025" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245025"
                     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 #13"></div>
  </section>
</div>
    <div class="postbit" id="245041" data-post-id="245041">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lgp" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lgp
                    <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">
								<p>Did you try to run it? I had a few problems…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245041" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-245041" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245041"
                     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 #14"></div>
  </section>
</div>
    <div class="postbit" id="245043" data-post-id="245043">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you for providing a pattern matching version of the code.</p>
<aside class="quote no-group" data-username="drolll" data-post="14" data-topic="46394">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/d26b3c/48.png" class="avatar"> drolll:</div>
<blockquote>
<p>With a functional language, there is seldom any advantage to the use of if-else or cond clauses IMHO.</p>
</blockquote>
</aside>
<p>Pattern matching provides a way to write code without <code>if</code>, <code>cond</code> or <code>case</code> - but there is no reason to avoid them completely. Elixir lang repo contains many instances of <code>if</code>, <code>cond</code> and <code>case</code> along with pattern matching.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245043" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-245043" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245043"
                     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 #15"></div>
  </section>
</div>
    <div class="postbit" id="245048" data-post-id="245048">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="drolll" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  drolll
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>No, in fact I noticed some typos after I sent it.  It was a “quick and dirty” but I’ll continue on it if you want more help.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245048" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-245048" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245048"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="245049" data-post-id="245049">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="drolll" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  drolll
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Agreed.  When I am first developing a module, I often use some conditionals for expediency but almost always find that my code is cleaner and clearer after refactoring later.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245049" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-245049" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245049"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="245051" data-post-id="245051">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="drolll" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  drolll
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It should be noted that I am well aware that my coding style will be considered my many to be heretical.  I come from the Erlang camp and have never been comfortable with OO or procedural languages.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245051" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-245051" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245051"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="245052" data-post-id="245052">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lgp" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lgp
                    <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">
								<p>Yeah, I fixed the typos (the missing function names and the period instead of a comma), but I couldn’t figure out how to fix this:<br>
def chk_range(:ok, cat, id) when id &lt;= <span class="mention">@cats</span>(cat),</p>
<p>I assumed that the parens should be brackets, but that led to a:<br>
cannot invoke remote function Access.get/2 inside guards</p>
<p>And that’s where I gave up on it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245052" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-245052" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245052"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="245173" data-post-id="245173">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="drolll" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  drolll
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Have now cleaned up my typos, incorporated kartheeks suggestion of using defaults (which helped clarify the code quite a bit), and tested the result.  Notice how using function calls eliminates the need for conditionals.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule JsonAPI do
  @c %{"posts"=&gt;100,"comments"=&gt;500,"albums"=&gt;100,"photos"=&gt;5000,"todos"=&gt;200,"users"=&gt;10}
  @b "https://jsonplaceholder.typicode.com/"

  def query(c, id \\ 0, keys \\ []),       do: chk_input(c, id) |&gt; request({c, id, keys})

  defp chk_input(c, id) ,                  do: is_cat(c in Map.keys(@c), c, id)

  defp is_cat(true, c, id),                do: in_range(id &lt;= @c[c], c)
  defp is_cat(_,    c, _ ),                do: {:error, "'#{c}' is invalid"}

  defp in_range(true, _ ),                 do: :ok
  defp in_range( _  , c ),                 do: {:error, "'#{c}' max id: #{@c[c]}"}

  defp request(:ok, {c, id, keys}),        do: lookup(c, id) |&gt; reply(keys)
  defp request({:error, msg},  _   ),      do: msg

  defp lookup(c, 0),                       do: HTTPoison.get("#{@b}#{c}")
  defp lookup(c, i),                       do: HTTPoison.get("#{@b}#{c}/#{to_string(i)}")

  defp reply({:error, reason }, _ ),              do: {:error,    reason}
  defp reply({_,%{status_code: 200,body: b}},[]), do: {:ok,       parse(b) }
  defp reply({_,%{status_code: 200,body: b}},k),  do: {:ok,       parse(b) |&gt; get_in(k) }
  defp reply({_,%{status_code:  s, body: b}},_),  do: {:error, s, parse(b) |&gt; get_in(["message"])}

  defp parse(body),                        do: Poison.Parser.parse!(body, %{})

  end
type or paste code here
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="245173" 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/how-do-i-clean-up-this-code-from-an-example-in-the-pragprog-elixir-course/46394/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-245173" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="245173"
                     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 #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/46394/load_more?page=3">Load more posts (3 remaining)</a>
</div></template></turbo-stream>