I'm new to rails and am having what I think is a very simple issue.
I have a list of "tasks". When you click on a task, I want to update its row in the database to mark it as complete (changing the "status" column form 0 to 1).
Here is what the links look like in my view:
<td><%= link_to t.name, change_task_status_path(:id => t.id) %>
And here is what's in my tasks_controller.rb:
def change_task_status
@t = Task.find_by_id(params[:id])
@t.status = '1' # 1 = complete
@t.save
render :nothing => true
end
I cannot figure out how to format the link correctly! I get this error when loading the view:
undefined method `change_task_status_path' for #<#<Class:0x3a6c144>:0x3a69d54>
EDIT rake routes shows:
tasks GET /tasks(.:format) tasks#index
POST /tasks(.:format) tasks#create
new_task GET /tasks/new(.:format) tasks#new
edit_task GET /tasks/:id/edit(.:format) tasks#edit
task GET /tasks/:id(.:format) tasks#show
PUT /tasks/:id(.:format) tasks#update
DELETE /tasks/:id(.:format) tasks#destroy
phases GET /phases(.:format) phases#index
POST /phases(.:format) phases#create
new_phase GET /phases/new(.:format) phases#new
edit_phase GET /phases/:id/edit(.:format) phases#edit
phase GET /phases/:id(.:format) phases#show
PUT /phases/:id(.:format) phases#update
DELETE /phases/:id(.:format) phases#destroy
projects GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project GET /projects/new(.:format) projects#new
edit_project GET /projects/:id/edit(.:format) projects#edit
project GET /projects/:id(.:format) projects#show
PUT /projects/:id(.:format) projects#update
DELETE /projects/:id(.:format) projects#destroy