# REST and custom routes

**URL:** <https://www.ruby-forum.com/t/rest-and-custom-routes/123546>\
**Category:** Rails\
**Created:** [December 18, 2007, 4:46pm UTC](https://www.ruby-forum.com/t/rest-and-custom-routes/123546 "2007-12-18T16:46:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcontonio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9d8465/32.png) [@jcontonio](https://www.ruby-forum.com/u/jcontonio)\
**Post date:** [December 18, 2007, 4:46pm UTC](https://www.ruby-forum.com/t/rest-and-custom-routes/123546/1 "2007-12-18T16:46:15Z")

</div>

So here’s what I do and lets see if someone can solve the problems

rails test  
cd test  
script/generate scaffold Task body:string completed:boolean  
rake db:create  
rake db:migrate

#routes.rb  
map.resources :tasks, :member =\> {:complete =\> :post}  
map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’

#tasks\_controller.rb  
def complete  
@task = Task.find(params[:id])  
@task.completed = true  
end

#index.html.erb

\<%=h task.body %\> \<%=h task.completed %\> \<%= link\_to 'Show', task %\> \<%= link\_to 'Edit', edit\_task\_path(task) %\> \<%= link\_to 'Destroy', task, :confirm =\> 'Are you sure?', :method =\> :delete %\> \<%= link\_to 'Complete', complete\_task\_path(task) %\>

script/server

Now, add a task then go back to index  
Click the Complete link and watch it go:

Unknown action  
No action responded to 1

And here’s what it’s doing in the log:  
Parameters: {“action”=\>“1”, “id”=\>“complete”, “controller”=\>“tasks”}

Why isn’t it recognizing it as action =\> complete, id =\> 1 ?

I can reproduce this every time so there’s nothing I’m doing that  
might trigger something like this.
