title: Routing error in ajax on ruby on rails
body: <p>I have this in my .html.erb code:</p>
  
  <pre><code> $.ajax({
   url: "/timeMachineEdit",
   data: {editTimeMachine: newArray},
   type: 'POST',
   success: function (res) {
       if (res.result === 'ok') {
       alert('Data saved');
       } else {
       alert('Save error');
       }
  },
  error: function () {
       alert('Save error.');
       }
  });
  </code></pre>
  
  <p>This in my datasets_controller.rb</p>
  
  <pre><code>def timeMachineEdit 
      @dataset = current_user.dataset
      @dataset.machine_time = params[:editTimeMachine]
  end
  </code></pre>
  
  <p>And in my routes.rb:</p>
  
  <pre><code>match "/timeMachineEdit", to: "datasets#timeMachineEdit"
  </code></pre>
  
  <p>But when is submited shows:</p>
  
  <pre><code>POST http://localhost:3000/timeMachineEdit 500 (Internal Server Error) 
  </code></pre>
  
  <p>Where is the problem here?
  is the routes in the ajax url or something else?</p>