Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you're getting confused with how to handle data in Rails (or any backend system)</p> <hr> <p><strong>HTML</strong></p> <p>HTML is a markup language; which means if you give it certain code, it will put various elements onto the page. The <code>&lt;table&gt;</code> tag is one of those elements, and has no bearing on the controller-side functionality of your app</p> <hr> <p><strong>Controller Params</strong></p> <p>HTML form params are directly related to the <code>form</code> (nothing else)</p> <p>In Rails, you get the params hash ordered like this:</p> <pre><code>params[:form_name][:input_name] </code></pre> <hr> <p><strong>Your Code</strong></p> <p>From what you've shown, it seems you have several parts missing</p> <p>Firstly, you need <code>input</code> elements (to populate the params). Currently, you have:</p> <pre><code>&lt;td contenteditable class="border light_green"&gt;&lt;%= value %&gt;&lt;/td&gt; </code></pre> <p>This does not create any params, as it's not an input element. It's just a value that's been outputted on the screen. What you'd need is something like:</p> <pre><code>&lt;td contenteditable class="border light_green"&gt;&lt;%= text_field_tag :cell, :value =&gt; value %&gt;&lt;/td&gt; </code></pre> <p>By adding these inputs, you will give Rails the ability to populate the params hash with their values, which you can then access from your controller like this:</p> <pre><code>def save @table = params[:form_name][:cell][0] end </code></pre> <p>Hope this helps?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload