title: an array is automatically stringified in rails with mongoid
body: <p>I'm new in using rails with mongoid and i have problems in storing an array in some field</p>
  
  <p>Here is the code to clarify everything</p>
  
  <p>in my model :</p>
  
  <pre><code>class Something
      include Mongoid::Document
      field :some_field, type: Array
  end
  </code></pre>
  
  <p>in my controller :</p>
  
  <pre><code>def create
  @something = Something.new(something_params)
      @something[:some_field] = params[:something][:some_field].split(',')
      if @something.save
          redirect_to @something, notice: "whatever"
      else
          render "new"
      end
  end
  </code></pre>
  
  <p>in my view : </p>
  
  <pre><code>&lt;%= form_for @something do |f| %&gt;
      &lt;div class="field"&gt;
          &lt;%= f.label :some_field %&gt;&lt;br&gt;
          &lt;%= f.text_area :some_field %&gt;
      &lt;/div&gt;
      &lt;div class="actions"&gt;
          &lt;%= f.submit %&gt;
      &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>when i use it that way i get an error message :
  "Problem: Value of type String cannot be written to a field of type Array Summary: Tried to set a value of type String to a field of type Array Resolution: Verify if the value to be set correspond to field definition"</p>
  
  <p>but when i change the field type to String , it is successfully added but with a stringified array</p>
  
  <p>I tried this :</p>
  
  <pre><code>render :text =&gt; @something[:some_field] #outputs : ["field1", "field2", "field3"]
  </code></pre>
  
  <p>but</p>
  
  <pre><code>render :text =&gt; @something[:some_field].inspect  #outputs : "[\"field1\", \"field2\", \"field3\"]"
  </code></pre>
  
  <p>What should i do to store the value as an Array ?</p>
  
  <p>Thanks</p>