Sha256: a0efe75b190a24db07f787d5b3917bc2024a54afeaef3108da06f51008197d51

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 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, { :gallery_actions => [ :show ]})
      #
      # This will only create the show action for galleries, but omit the index action.
      def self.routes(router, options = {})
        options.reverse_merge!(
          gallery_actions: [:index, :show],
          picture_actions: [:index, :show]
        )

        router.resources :ecm_pictures_galleries, only: options[:gallery_actions], controller: 'ecm/pictures/galleries'
        router.resources :ecm_pictures_pictures, only: options[:picture_actions], controller: 'ecm/pictures/pictures'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecm_pictures2-3.0.1 lib/ecm/pictures/routing.rb
ecm_pictures2-3.0.0 lib/ecm/pictures/routing.rb