title: How to call a custom method in a Rails controller from a View
body: <p>I have set up a site that is correctly using basic CRUD functionality succesfully. However, when I try to add a custom method to my controller I cannot seem to hook it up to a <code>link_to</code> call. I keep getting a <code>method not found</code> error.</p>
  
  <p>The Controller method looks like this:</p>
  
  <pre><code>def complete
      return render :text =&gt; "Complete"
  end
  </code></pre>
  
  <p>and my call in the View looks like this:</p>
  
  <pre><code>&lt;%= link_to 'Complete', complete_list_task_path(@list,@task) %&gt;
  </code></pre>
  
  <p>This same call works for my Edit method, so I'm not sure what I'm doing wrong. Do I need to do anything special when the method is not a basic CRUD call?</p>
  
  <p>The only relevant part of my route file looks like this (List and Task are nested resources. List has many tasks, and task belongs to a list):</p>
  
  <pre><code>resources :lists do
      resources :tasks
  end
  </code></pre>
  
  <p>I have also tried adding <code>post "complete" =&gt; "lists/:id/tasks/:id#complete", :as =&gt; "complete"</code> to my route to see if it would help to implicitly try to call it, but I still got a "method not found error".</p>
  
  <p>Any help in figuring out how to make this call would be greatly appreciated. Thank you!</p>