title: Error in resource configuration while using $resource.query() function with AngularJS/Rails
body: <p>I'm new to angular and I'm trying to add it to one of my Rails projects. I'm using the angular-rails gem. I want to list users using $resource.query() and I'm getting the following error:   </p>
  
  <blockquote>
    <p>Error: [$resource:badcfg] Error in resource configuration. Expected response to contain an array but got an object  </p>
  </blockquote>
  
  <p>When I check localhost:3000/users.json it's showing an array of user objects, so the response should be in the correct format. Here's what I have:</p>
  
  <p>In app/assets/javascript/users.js.coffee:</p>
  
  <pre><code>app = angular.module("Volunteers", ["ngResource"])
  
  app.factory "User", ["$resource", ($resource) -&gt;
    $resource("/users/:id", {id: "@id"}, {update: {method: "PUT"}})
  ]
  
  @UserCtrl = ["$scope", "User", ($scope, User) -&gt;
    $scope.users = User.query()
  ]
  </code></pre>
  
  <p>In app/views/users/index.html:</p>
  
  <pre><code>&lt;div ng-controller="UserCtrl"&gt;
    &lt;ul&gt;
      &lt;li ng-repeat="user in users"&gt;
        {{user.name}}
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And in the users_controller:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
      respond_to :json, :html 
  
      def index
          respond_with User.all
      end
  </code></pre>