Hello,

I'm new to rails so this will be a noob question.

Let's say I scaffold sth. named "foos".

Rails generates a controller named foos_controller.rb with index,
show, new, edit, create, update and destroy.

The routes.rb contains

map.resources :foos
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

So, by visiting "/foos/new" I can create a new "foo". By visiting /
foos/new/1 I get routed to the show action with the parameter id=1
that shows the contents of this object. Okay, i get that.

But, what happens when I go to "/foos/1/edit". This is not matching
"map.connect ':controller/:action/:id'" since action and id are
switched. Is scaffold doing some magic here, that I can't find in the
sources? When I add a method, say "my_edit" with the exact content of
the "edit" method, i get "Unknown action No action responded to 1.",
what I expected because my URI is not matching the map.connect in the
routes.rb.

Short questions:
How does rails know the routing of /foos/1/edit without the
map.connect?
When i want to create something like that, how do I do that?

Sorry for my poor english.

Greetings from germany.

got_nil

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to