[Rails] Rails routes - destroy
Can't figure out how duplicate routes are differentiated by rails ...
Read routing from inside out and API as well as a few tutorials but
still don't get it!!! For example...
routes.rb
resources :minisections do
resources :questions
end
rake routes:
minisection_question GET
/minisections/:minisection_id/questions/:id(.:format)
questions#show
PUT
/minisections/:minisection_id/questions/:id(.:format)
questions#update
DELETE
/minisections/:minisection_id/questions/:id(.:format)
questions#destroy
In the view:
<%= link_to 'Delete', minisection_question_path(:minisection_id =>
@minisection.id,
:id => question.id),
:confirm => 'Are you sure?',
:method => :delete %>
SO the GET, PUT, and DELETE routes are the same. The view listed above
ends up requesting the first route ie "show" method even though I have
:method => :delete. ...so how to specify to to rails to delete a
question!
Thanks,
Dave
--
Posted via http://www.ruby-forum.com/.
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home