In a Rails controller creating a new index in a 'map.do' loop fails, yet it's fine in Ruby
<p>I have a bunch of records from a database using <code>select id, parent_id....</code> and loop over them using <code>map.do</code> creating a new index on each row.</p>

<pre><code>records = results.map do |row|
    row['childs'] = {}
    comments[row['id']] = row
end
</code></pre>

<p>This works fine when called from the command-line but when placed in the Rails context I get the following error:</p>

<pre><code>&gt;ActiveModel::MissingAttributeError in CommentsController#index
can't write unknown attribute `childs'
</code></pre>

<p>Any idea what this would work in Ruby at the command line and not Rails? What am I missing about how Rails works? </p>