Ruby Mash using
<p>Im using Grape and can't understand why i can't alter params Mash.</p>

<pre><code>  class Publisher &lt; ActiveRecord::Base  
  end
</code></pre>

<p>Following is working fine:</p>

<pre><code>  post do
    Publisher.create!({
      name: params[:name],
      partner_id: @current_partner.id
    })
  end
</code></pre>

<p>and creates new record in my DB with <code>name</code> and <code>partner_id</code> provided</p>

<p>but i have many entries in <code>params</code> so i want to just add <code>partner_id</code> to them.</p>

<pre><code>  post do
    p params
    params.partner_id = @current_partner.id
    p params
    Publisher.create!(params.require(:name, :partner_id))
  end
</code></pre>

<p>output:</p>

<pre><code>#&lt;Hashie::Mash name="myName"&gt;
#&lt;Hashie::Mash name="myName" partner_id=1&gt;
</code></pre>

<p>but it insert line in DB with <code>NULL</code> in <code>partner_id</code> column</p>

<p>Is it incorrect use?</p>

<p>Also i can't use just <code>params</code> in <code>update()</code> because of <code>ActiveModel::ForbiddenAttributesError</code> is it correct workaround?</p>