title: Rails 4.1 ActionController::UnknownFormat error for respond_with using AngularJS
body: <p>Keep getting ActionController:UnknownFormat error when trying to use respond_to and respond_with in rails controller. Error on the following line in controller.</p>
  
  <pre><code>respond_with @surveys 
  </code></pre>
  
  <p>In /app/assets/controllers/surveys_controller</p>
  
  <pre><code>respond_to :json
  
  def index
    @surveys = Survey.all
    respond_with @surveys
  end
  </code></pre>
  
  <p>In /config/routes.rb</p>
  
  <pre><code>WebInsight::Application.routes.draw do
  
     scope :api do
        resources :surveys, defaults: {format: 'json'}
     end
  
     resources :surveys
  end
  </code></pre>
  
  <p>In /app/assets/views/surveys/index.html.erb</p>
  
  <pre><code>&lt;h1&gt;Your Surveys&lt;/h1&gt;
  
  &lt;form&gt;
    &lt;input type="text" ng-model='newSurvey' placeholder="Enter a survey"&gt;
    &lt;input type="submit" value="Add"&gt;
  &lt;/form&gt;
  
  &lt;div ng-controller="SurveysCtrl"&gt;
      &lt;ul&gt;
          &lt;li ng-repeat="survey in surveys"&gt;
            {{ survey.theme_id }}, {{ survey.name }}, {{ survey.description }}
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In /app/assets/javascripts/angular/controllers/surveys_ctrl.js</p>
  
  <pre><code>app.controller('SurveysCtrl', ['$scope', '$resource', function($scope, $resource) {
     var Surveys = $resource('/api/surveys');
     $scope.surveys = Surveys.query();
  }]);
  </code></pre>