ruby on rails - Why resources on collection has different routing helper then regular post -
in routes.rb had resource
resources :home_screen_buttons post :update_multiple, :on => :collection end
update_multiple helper update_multiple_home_screen_buttons
then decided remove resource because need update_multiple method in controller, changed routes.rb to
post "home_screen_buttons/update_multiple"
it create helper home_screen_buttons_update_multiple instead of update_multiple_home_screen_buttons
why has different routing helper name?
it makes sense :on => :collection has different helper :on => :member, there other way adding :as => :update_multiple_home_screen_buttons post method same behavior?
this how rails this. when match
used, maps uri action , creates corresponding helper path controller_action_path
when used collection, becomes restful action resource , rails gives logical name relating collection. quoted example here:
resources :photos collection 'search' end end
generates search_photos_path
.
you have done this:
resources :home_screen_buttons, :only => [:update_multiple] post :update_multiple, :on => :collection end
Comments
Post a Comment