views:

18

answers:

1

Suppose i have indicated that network is a resource. I am adding a new action, say "submit_question_for_network" to the controller.

However, after I added the action to the controller, it does not work

# does not work
/network/submit_question_for_network  

# need to add to :collection
map.resources :network,  :collection => {:submit_question_for_network => :post,:submit_new_or_join=>:post}   

However, i clearly remember that it works without needing to do anything sometimes. What is going on?

# it is trying to do "show", instead of calling the action
Processing NetworkController#show (for 127.0.0.1 at 2010-09-09 00:07:42) [GET]
  Parameters: {"id"=>"v4test"}
A: 

You've defined the two collection routes as post requests, however you're making a get request.

If you want to make a get request then redefine the route as so. If on the other hand you want to post a form then add :method => :post to the form helper method.

mark