title: Completed 500 Internal Server Error in 2ms (Views: 1.0ms | ActiveRecord: 0.0ms)
body: <p>I want create new method by post data to rails server and create action to save data to database. I post data correctly and data save to database correct. But at end I get <code>500 internal error</code>. I show <code>create</code> action:</p>
  
  <pre><code>class Api::V1::BolouksController &lt; Api::V1::BaseController
    def create
      @bolouk = Bolouk.create(bolouk_params)
      @bolouk.save
      respond_with(@bolouk)
    end
    private
    def bolouk_params
      params.require(:bolouk).permit(:boloukcode, :north, :south, :east, :west)
    end
  end
  </code></pre>
  
  <p>And server log:</p>
  
  <pre><code>Started POST "/api/bolouks.json" for 127.0.0.1 at 2014-08-31 12:36:10 +0430
  Processing by Api::V1::BolouksController#create as JSON
    Parameters: {"south"=&gt;"76876", "west"=&gt;"46365", "east"=&gt;"987987", "north"=&gt;"897987", "boloukcode"=&gt;"21321", "bolouk"=&gt;{"boloukcode"=&gt;"21321", "north"=&gt;"89798
  7", "south"=&gt;"76876", "east"=&gt;"987987", "west"=&gt;"46365"}}
     (0.0ms)  begin transaction
    SQL (0.0ms)  INSERT INTO "bolouks" ("boloukcode", "created_at", "east", "north", "south", "updated_at", "west") VALUES (?, ?, ?, ?, ?, ?, ?)  [["boloukcode",
   "21321"], ["created_at", "2014-08-31 08:06:10.645999"], ["east", "987987"], ["north", "897987"], ["south", "76876"], ["updated_at", "2014-08-31 08:06:10.64599
  9"], ["west", "46365"]]
     (96.6ms)  commit transaction
     (0.0ms)  begin transaction
     (0.0ms)  commit transaction
  Completed 500 Internal Server Error in 162ms (Views: 1.0ms | ActiveRecord: 96.6ms)
  </code></pre>
  
  <p>I don't know the problem, because when I remove all method of <code>create</code> action, I again get <code>500 Internal Error</code>.</p>
  
  <pre><code>class Api::V1::BolouksController &lt; Api::V1::BaseController
    def create
    end
  end
  </code></pre>
  
  <p><code>server log</code>:</p>
  
  <pre><code>Started POST "/api/bolouks.json" for 127.0.0.1 at 2014-08-31 12:40:48 +0430
  Processing by Api::V1::BolouksController#create as JSON
    Parameters: {"south"=&gt;"543543", "west"=&gt;"76875", "east"=&gt;"4312432", "north"=&gt;"987967", "boloukcode"=&gt;"68987", "bolouk"=&gt;{"boloukcode"=&gt;"68987", "north"=&gt;"987
  967", "south"=&gt;"543543", "east"=&gt;"4312432", "west"=&gt;"76875"}}
  Completed 500 Internal Server Error in 11ms (Views: 0.0ms | ActiveRecord: 0.0ms)
  </code></pre>
  
  <p>I cannot understand the problem. Where is the problem? How can I fix <code>500 Internal Error</code>?
  Update question:</p>
  
  <p>I post data from angularjs code, I add angular controller and service below:</p>
  
  <pre><code>'use strict';
  var app = angular.module('app');
  app.controller('BoloukCtrl', ['$scope','Session', 'Bolouks', 'Secure', function($scope, Session, Bolouks, Secure){
      $scope.bolouk = {};
      $scope.bolouk.boloukcode  = $scope.bolouk.north = $scope.bolouk.east  = $scope.bolouk.west  = $scope.bolouk.south = "";
  
      $scope.save = function(){
          var alaki = Bolouks.create($scope.bolouk);
          $scope.bolouk = {};
          $scope.bolouk.boloukcode  = $scope.bolouk.north = $scope.bolouk.east  = $scope.bolouk.west  = $scope.bolouk.south = "";
      }
  }]);
  </code></pre>
  
  <p><code>boloukService.js</code>:</p>
  
  <pre><code>'use strict';
  var app = angular.module('boloukService', ['ngResource']);
  app.factory('Bolouks', function($resource) {
      return $resource('/api/bolouks.json', {}, {
          index: { method: 'GET', isArray: true},
          create: { method: 'POST' }
      });
  });
  </code></pre>
  
  <p><code>view.html</code>:</p>
  
  <pre><code>&lt;form ng-submit="save()" class="form-horizontal" role="form"&gt;
          //I complete bolouk field and then post to angularjs controller and by using service, post to rails server.
  &lt;/form&gt;
  </code></pre>