title: AFNetworking + AFJSONRequestOperation + Rails
body: <p>I'm using NSMutableURLRequest before using AFJSONOperationRequest and I have a problems getting the data in my Rails app.</p>
  
  <p>If I use :</p>
  
  <pre><code>  NSMutableURLRequest *request = [[HTTPClient sharedClient] multipartFormRequestWithMethod:@"POST" path:path parameters:dict constructingBodyWithBlock: ^(id &lt;AFMultipartFormData&gt;formData) 
    {
    }]; 
  </code></pre>
  
  <p>Then :</p>
  
  <pre><code>AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) 
    { 
      else {
      }
    } 
  </code></pre>
  
  <p>I get my data correctly formatted in the Rails logs: </p>
  
  <pre><code>Parameters: {"contact"=&gt;{"country_id"=&gt;"45", "lastname"=&gt;"Tutu"}}
  </code></pre>
  
  <p>But I don't need AFMultipartFormData to send a file... (no file to send)</p>
  
  <p>So, instead, I use:</p>
  
  <pre><code>  NSMutableURLRequest *request = [[HTTPClient sharedClient] multipartFormRequestWithMethod:@"POST" path:path parameters:dict];
  </code></pre>
  
  <p>with my AFJSONRequestOperation too. But, my parameters are now not set correctly in my rails app:</p>
  
  <pre><code>Parameters: {contact[country_id] =&gt; "45", contact[lastname] =&gt; "Tutu"} 
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>Parameters: {"contact"=&gt;{"country_id"=&gt;"45", "lastname"=&gt;"Tutu"}}
  </code></pre>
  
  <p>I don't understand why. It looks like the body of the request is not set correctly when I don't use the block: "constructingBodyWithBlock".</p>