module ActionDispatch::Routing class Mapper def sortable_nested_set_for(category_type) resources category_type do member do get :sns_toggle get :sns_add_subcategory get :sns_add_item delete :sns_destroy_category end collection do put :sns_sort_categories put :sns_sort_items end end resources category_type.to_s.classify.constantize.sns_items_type do delete :sns_destroy_item, :on => :member, :controller => category_type end end end end