title: Angular POST request not formatting correctly
body: <p>I have a very simply angular form that looks like this:</p>
  
  <pre><code>&lt;form ng-submit="createNewQuestion()" name="createNewQuestionForm"&gt;
    &lt;div class="form-group"&gt;
      &lt;textarea class="form-control" rows="3" ng-model="question.question" placeholder="Add a question here."&gt;&lt;/textarea&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
      &lt;textarea class="form-control" rows="3" ng-model="question.answer" placeholder="Add the answer here."&gt;&lt;/textarea&gt;
    &lt;/div&gt;
    &lt;button type="submit" class="btn btn-default"&gt;Next&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>It submits to the CreateNewQuestion() function in the controller, which looks like this:</p>
  
  <pre><code>$scope.createNewQuestion = function () {
    $scope.question.droplet_id = $scope.createdDroplet.id; //add droplet_id to form data
    question.create($scope.question).success(function(question) {
      $scope.questions.push(question); //return the question and put it in the helps variable
      $scope.question = {}; // clear form
    });
  };
  </code></pre>
  
  <p>This calls the factory for the POST request which looks like this:</p>
  
  <pre><code>app.factory('question', ['$http', function($http) {
    return {
      create: function (question) {
        return $http.post('/questions/', question)
      }
    }
  }]);
  </code></pre>
  
  <p>The request gets made on submit but the params are in the wrong format. The log looks like this:</p>
  
  <pre><code>Processing by QuestionsController#create as HTML
    Parameters: {"question"=&gt;"some_question", "answer"=&gt;"some_answer", "droplet_id"=&gt;785}
  Completed 500 Internal Server Error in 3ms
  
  NoMethodError (undefined method `permit' for "vhjkhfjhgfjhg":String):
  </code></pre>
  
  <p>Here's the weird thing. I have identical code with copy and pasted forms and functions that sends the data in the correct format for my rails backend, which would be:</p>
  
  <pre><code>Parameters: {"question"=&gt;"question", "answer"=&gt;"answer", "drop_id"=&gt;485, "question"=&gt;{"question"=&gt;"question", "answer"=&gt;"answer", "drop_id"=&gt;485}}
  </code></pre>
  
  <p>The fields are different but the code is literally identical. Why is one working while the other is not and how can I fix it?</p>
  
  <p><strong>Update</strong></p>
  
  <p>It seems to be a naming issue on the backend, so the request is okay. If I remove require(:question) from:</p>
  
  <pre><code>params.require(:question).permit(:question, :answer, :droplet_id, :ordering)
  </code></pre>
  
  <p>it works. It seems it doesn't like the model name being the same as one of the attributes.</p>