URL mapping in routes.rb

Hi,

I have the following mapping in routes.rb.

map.resources :definitions, :member=>{:execute=>:post}, :collection=>{:select=>:get} do |def|     def.resources :definition_fields end

Now I am able to access the 'index' method of definition_fields_controller.rb by the following code.

definition_definition_fields_path(@definition)

It works well. But when I tried calling the 'new' method of definition_fields_controller.rb with the following syntax, it failed.

definition_new_definition_field_path(@definition)

What is the right way to call the 'new' and 'edit' methods when this kind of mapping is used???

Thanks in advance...

- Karthik.

Karthi kn wrote:

map.resources :definitions, :member=>{:execute=>:post}, :collection=>{:select=>:get} do |def|     def.resources :definition_fields end

You will probably want to replace "def" with something else as it is a Ruby keyword...

What is the right way to call the 'new' and 'edit' methods when this kind of mapping is used???

new_definition_definition_field edit_definition_definition_field

Your friend here is "rake routes" which will give you all the details of how URLs are mapped to controllers and actions and what helper methods are available.