Sha256: 134b27c8239e4560dedac64fa893dc61c66a86018958f2aa4ad91662ae119423

Contents?: true

Size: 862 Bytes

Versions: 6

Compression:

Stored size: 862 Bytes

Contents

module Ecm
  module Pictures
    class Routing
      # Creates the routes for pictures and galleries. You can pass options to
      # specify the actions for both pictures and/or galleries.
      #
      #   Ecm::Pictures::Routing.routes(self, { :picture_gallery_actions => [ :show ]})
      #
      # This will only create the show action for picture galleries, but omit the index action.
      def self.routes(router, options = {})
        options.reverse_merge!(
          picture_gallery_actions: [:index, :show],
          picture_actions: [:index, :show]
        )

        router.resources :ecm_pictures_picture_galleries, only: options[:picture_gallery_actions], controller: 'ecm/pictures/picture_galleries'
        router.resources :ecm_pictures_pictures, only: options[:picture_actions], controller: 'ecm/pictures/pictures'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecm_pictures2-2.1.4 lib/ecm/pictures/routing.rb
ecm_pictures2-2.1.3 lib/ecm/pictures/routing.rb
ecm_pictures2-2.1.2 lib/ecm/pictures/routing.rb
ecm_pictures2-2.1.1 lib/ecm/pictures/routing.rb
ecm_pictures2-2.1.0 lib/ecm/pictures/routing.rb
ecm_pictures2-2.0.0 lib/ecm/pictures/routing.rb