title: How do I set up a route to a custom method in a controller?
body: <p>I created (read generated) a scaffold. In the same generated controller, I defined a custom method which just executes a <code>puts</code> command in the console. How can I call this method? Where do I set up the routes for the method in question? I'm trying to call the method with an ajax call, but I keep getting Resource not found (404).</p>
  
  <p>routes:</p>
  
  <pre><code> resources :projects do
      collection do
        put 'export_excel'
      end
    end
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>def export_excel
      puts 'yay from controller'
  end
  </code></pre>
  
  <p>front-end:</p>
  
  <pre><code>exportExcel: function(){
              $.ajax({
                  type: "POST",
                  url: "/projects/export_excel",
                  async: false,
                  success: function(){
                      console.log('yay!');
                  },
                  error: function(){
                      console.log('nay!');
                  }
              });
          }
  </code></pre>