Sha256: f7ebd715ecaaec9a97de163cfa72e5df7eaf3c41f7cd1f4bed3916b4268de12c

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

module Ecm
  module Downloads
    class Routing
      # Creates the routes for downloads and categories. You can pass options to
      # specify the actions for both downloads and/or categories.
      #
      #   Ecm::Downloads::Routing.routes(self, { :download_category_actions => [ :show ]})
      #
      # This will only create the show action for download categories, but omit the index action.
      def self.routes(router, options = {})
        options.reverse_merge!(
          download_category_actions: [:index, :show],
          download_actions: [:index, :show],
          add_download_member_action: false
        )

        router.resources :ecm_downloads_download_categories, only: options[:download_category_actions], controller: 'ecm/downloads/download_categories'
        router.resources :ecm_downloads_downloads, only: options[:download_actions], controller: 'ecm/downloads/downloads' do
          router.get :download, on: :member, if: options[:add_download_member_action]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ecm_downloads2-3.0.0 lib/ecm/downloads/routing.rb
ecm_downloads2-2.0.3 lib/ecm/downloads/routing.rb
ecm_downloads2-2.0.2 lib/ecm/downloads/routing.rb
ecm_downloads2-2.0.0 lib/ecm/downloads/routing.rb