# Trouble with routes

**URL:** <https://www.ruby-forum.com/t/trouble-with-routes/160495>\
**Category:** Rails\
**Created:** [February 17, 2009, 1:04am UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495 "2009-02-17T01:04:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bearblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bearblu](https://www.ruby-forum.com/u/bearblu)\
**Post date:** [February 17, 2009, 1:04am UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495/1 "2009-02-17T01:04:23Z")

</div>

I just started working with Rails 2.2.2 and I don’t seem to be having  
much luck with the new routing scheme. When I try to edit a record  
and save it I get and error message that looks as though it is trying  
to use the id for the action. So just what am I doing wrong?

No action responded to 8. Actions: check\_authorization, create,  
destroy, edit, index, logged\_in?, make\_profile\_vars, nav\_link, new,  
paginate, paginated?, param\_posted?, protect, show, text\_field\_for,  
and update

---

<div class="post-metadata">

**Author:** ![bearblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bearblu](https://www.ruby-forum.com/u/bearblu)\
**Post date:** [February 17, 2009, 1:06am UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495/2 "2009-02-17T01:06:44Z")

</div>

Show us your action.

---

<div class="post-metadata">

**Author:** ![bearblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bearblu](https://www.ruby-forum.com/u/bearblu)\
**Post date:** [February 17, 2009, 1:15am UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495/3 "2009-02-17T01:15:31Z")

</div>

The edit action is:

def edit  
@title = “Pinnacle Harvest: Edit Vendor”  
@vendor = Vendor.find(params[:id])  
end

the update action is:

def update  
raise params.inspect  
@vendor = Vendor.find(params[:id])

```
respond_to do |format|
  if @vendor.update_attributes(params[:vendor])
    flash[:notice] = 'Vendor was successfully updated.'
    format.html { redirect_to :action => 'index' }
    format.xml { head :ok }
  else
    format.html { render :action => "edit" }
    format.xml { render :xml => @vendor.errors, :status

```

=\> :unprocessable\_entity }  
end  
end  
end

the edit.html.erb file is:  
\<% form\_for :vendor do |form| %\>

 \<%= @title %\>

\<%= error\_messages\_for ‘vendor’ %\>  
\<%= text\_field\_for form, “name” %\>  
\<%= text\_field\_for form, “city” %\>  
\<%= text\_field\_for form, “state” %\>  
\<%= text\_field\_for form, “zip\_code”, ZIP\_CODE\_LENGTH %\>  
\<%= text\_field\_for form, “phone\_number” %\>  
\<%= text\_field\_for form, “fax\_number” %\>  
\<%= text\_field\_for form, “web\_url” %\>

\<%= submit\_tag “Update”, :class =\> “new\_client\_vendor\_submit” %\>

\<% end %\>

There is nothing fancy, I am pretty much a novice at Rails. 😉

Rick

---

<div class="post-metadata">

**Author:** ![bearblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bearblu](https://www.ruby-forum.com/u/bearblu)\
**Post date:** [February 17, 2009, 2:53am UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495/4 "2009-02-17T02:53:11Z")

</div>

That’s a rather strange error considering you’re not even trying to  
redirect to :show after an update, but rather just :index.

Further strange are the actions it says are valid:  
check\_authorization, create,  
destroy, edit, index, logged\_in?, make\_profile\_vars, nav\_link, new,  
paginate, paginated?, param\_posted?, protect, show, text\_field\_for,  
and update

What is the URL that results in this error? Do you have some other  
plugins that might be adding these other actions?

---

<div class="post-metadata">

**Author:** ![bearblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bearblu](https://www.ruby-forum.com/u/bearblu)\
**Post date:** [February 17, 2009, 3:29am UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495/5 "2009-02-17T03:29:29Z")

</div>

There are no plugins, I do have several gems installed… but you just  
got me to thinking. Yep, it looks as though my code base got  
corrupted.

Thanks,

Rick

---

<div class="post-metadata">

**Author:** ![bearblu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@bearblu](https://www.ruby-forum.com/u/bearblu)\
**Post date:** [February 17, 2009, 7:40pm UTC](https://www.ruby-forum.com/t/trouble-with-routes/160495/6 "2009-02-17T19:40:59Z")

</div>

You need to show your routes.rb file as well. This is the file that  
routes requests to controllers and actions within them.  
Bharat
