title: How to access attributes of object sent to controller in rails
body: <p>I have a trivial question but even after 2 days checking on stackoverflow I haven't found a solution.</p>
  
  <p>When I forward the params to read a record from a database all works - but I found no way to access the parameters directly creating a view object or a columns array.</p>
  
  <p>I receive following post request in my rails controller:</p>
  
  <pre><code>Started POST "/views/update" for 127.0.0.1 at 2017-08-07 17:27:51 +0400
  Processing by ViewsController#update as HTML
    Parameters: {
      "view"=&gt;{
        "id"=&gt;1, 
        "name"=&gt;"All Opportunties", 
        "columns"=&gt;[
          {
            "id"=&gt;1, 
            "label"=&gt;"Name", 
            "fieldNameOrPath"=&gt;"name", 
            "typ"=&gt;"link", 
            "linkp"=&gt;"id", 
            "link"=&gt;"/opportunities/proposal/general", 
            "entity_id"=&gt;1, 
            "hidden"=&gt;true, 
            "created_at"=&gt;"2017-08-06T22:12:03.000Z", 
            "updated_at"=&gt;"2017-08-06T22:12:03.000Z"
          }, 
          {
            "id"=&gt;2, 
            "label"=&gt;"Account", 
            "fieldNameOrPath"=&gt;"account.name", 
            "typ"=&gt;"link", "linkp"=&gt;"account_id", 
            "link"=&gt;"/accounts", 
            "entity_id"=&gt;1, 
            "hidden"=&gt;false, 
            "created_at"=&gt;"2017-08-06T22:12:03.000Z", 
            "updated_at"=&gt;"2017-08-06T22:12:03.000Z"
          },
          {
            "id"=&gt;3, 
            "label"=&gt;"Owner", 
            "fieldNameOrPath"=&gt;"user.username", 
            "typ"=&gt;"string", 
            "linkp"=&gt;nil, 
            "link"=&gt;nil, 
            "entity_id"=&gt;1, 
            "hidden"=&gt;false, 
            "created_at"=&gt;"2017-08-06T22:12:03.000Z", 
            "updated_at"=&gt;"2017-08-06T22:12:03.000Z"
          },
          {
            "id"=&gt;4, 
            "label"=&gt;"Close Date", 
            "fieldNameOrPath"=&gt;"closedate", 
            "typ"=&gt;"datetime", 
            "linkp"=&gt;nil, 
            "link"=&gt;nil, 
            "entity_id"=&gt;1, 
            "hidden"=&gt;false, 
            "created_at"=&gt;"2017-08-06T22:12:03.000Z", 
            "updated_at"=&gt;"2017-08-06T22:12:03.000Z"
            }, 
            {
              "id"=&gt;5, 
              "label"=&gt;"Stage", 
              "fieldNameOrPath"=&gt;"stage", 
              "typ"=&gt;"string", 
              "linkp"=&gt;nil, 
              "link"=&gt;nil, 
              "entity_id"=&gt;1, 
              "hidden"=&gt;false, 
              "created_at"=&gt;"2017-08-06T22:12:03.000Z", 
              "updated_at"=&gt;"2017-08-06T22:12:03.000Z"
            }
          ]
        }
      }
  </code></pre>
  
  <p>Ideally I want to have the received parameter in an object called <code>view</code> from where I can access its attributes - specially the columns array. My object structure is:</p>
  
  <pre><code>View { id, name, columns [{id, label ...}] }
  </code></pre>
  
  <p>I want to loop through all columns:</p>
  
  <pre><code>view.columns.each do |column|
    column.name = ...
  end
  </code></pre>
  
  <p>It looks to me very basic but all methods I tried to assign the params to view (or create an object for columns only) failed. Most time I get the error message <code>method xxx of view</code> unknown.</p>
  
  <p>Thanks for helping!</p>