Sha256: d7ba0f59530c70dfb8624dfccec5eddcc575955af6d3ae924c186bb98448d1c3

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

#######################################################################################################
# Substantial portions of this code were adapted from the Radiant CMS project (http://radiantcms.org) #
#######################################################################################################

module Spree
  module RoutingExtension
  
    def self.included(base)
      base.class_eval do
        alias :draw_without_plugin_routes :draw
        alias :draw :draw_with_plugin_routes
      end
    end

    def draw_with_plugin_routes   
      draw_without_plugin_routes do |mapper|
        add_extension_routes(mapper)
        yield mapper
      end
    end

    private
  
      def add_extension_routes(mapper)
        Extension.descendants.each do |ext|
          ext.route_definitions.each do |block|
            block.call(mapper)
          end
        end
      end
    
  end
end

ActionController::Routing::RouteSet.class_eval { include Spree::RoutingExtension }

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree-0.4.1 lib/plugins/extension_patches/lib/routing_extension.rb
spree-0.5.0 lib/plugins/extension_patches/lib/routing_extension.rb
spree-0.5.1 lib/plugins/extension_patches/lib/routing_extension.rb