title: I would like to create an HTML table from multiple databases RoR
body: <p>I am fairly new to ruby of rails, but I would like to build this table from my MySQL database, consisting of two tables, Parents and Children.</p>
  
  <pre><code>enter code here
  </code></pre>
  
  <p>Children (:id, :name, :parentId)<br>
  Parent (:id, :name, :childId)</p>
  
  <p>Here is the HTML code:</p>
  
  <pre><code>&lt;% @children.each do |child| %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= link_to child.name, child_path(child) %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= child.ticker %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= link_to child.parent, parent_path(parent) %&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The table would be able to link to the show path of both tables, but only when child.parentId = parent.id. The table is on my table page with controller</p>
  
  <pre><code>class StaticPagesController &lt; ApplicationController
  
    def table
       @children = Child.all.order('name ASC')
            if params(:id) == child.parentId
                @parent = Parent.find(params[id])
            else
                @parent = NULL
            end
     end
  end
  </code></pre>
  
  <p>I know this is incorrect, but I am struggling to create this table.  Any feedback or references are helpful!</p>
  
  <p>Thank you in advance.</p>