module ActionDispatch::Routing class Mapper def sortable_nested_set_for(category_type) resources category_type do get :sns_toggle, :on => :member get :sns_add_subcategory, :on => :member get :sns_add_item, :on => :member put :sns_sort_categories, :on => :collection put :sns_sort_items, :on => :collection delete :sns_destroy_category, :on => :member 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