Sha256: 23823d911cced86045ed862a395a382a6323d2810b844b43b008517876d892de

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

module ActionDispatch::Routing
  class Mapper
    def sortable_nested_set_for(category_type)
      item_type = category_type.to_s.classify.constantize.sns_items_type

      resources category_type do
        resources category_type, :as => "sub#{category_type}"
        resources item_type

        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 item_type do
        delete :sns_destroy_item, :on => :member, :controller => category_type
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sortable_nested_set-0.1.26 lib/sortable_nested_set/routes.rb
sortable_nested_set-0.1.25 lib/sortable_nested_set/routes.rb