title: How angularjs resource post data
body: <p>Im working with a simple service, posting some data. At the moment I have a service like this:</p>
  
  <pre><code>sitekServices.factory('Books', ['$resource',
    function($resource){
      return $resource('books/:id.json', {id:'@id'});
    }]
  );
  </code></pre>
  
  <p>In the code I build an object like this.</p>
  
  <blockquote>
    <p>$scope.book = Books.get({id:0})</p>
  </blockquote>
  
  <p>Which builds for me an empty object with some default values. In the application I fill the rest of the object to get something like this:</p>
  
  <pre><code>$scope.book =
  {
    payment_method: 'Cash',
    provider: 'Acme',
    detail: [{isbn:'foo', price:123}]
  }
  </code></pre>
  
  <p>But when I post the data with</p>
  
  <blockquote>
    <p>$scope.book.$save()</p>
  </blockquote>
  
  <p>The data received in the server (rails app) is in the form of:</p>
  
  <pre><code>{
    :payment_method =&gt; 'Cash',
    :provider =&gt; 'Acme'
    :detail =&gt; [{:isbn =&gt; 'foo', :price =&gt; 123}]
    :book =&gt; {
      :payment_method =&gt; 'Cash',
      :provider =&gt; 'Acme'
    }
  }
  </code></pre>
  
  <p>Is this a normal behavior?</p>