Sha256: bc5da37512fdc111a41d323e6d18729482587b147288f9122b16781dd28ccf84

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

module ActionDispatch
  module Routing
    class Mapper
      module Base
        private
          def define_generate_prefix(app, name)
            return unless app.respond_to?(:routes) && app.routes.respond_to?(:define_mounted_helper)

            _route = @set.named_routes.routes[name.to_sym]
            _routes = @set
            app.routes.define_mounted_helper(name)
            app.routes.class_eval do
              define_method :_generate_prefix do |options|
                prefix_options = options.slice(*_route.segment_keys)
                # we must actually delete prefix segment keys to avoid passing them to next url_for
                _route.segment_keys.each { |k| options.delete(k) }
                mount_path = _routes.url_helpers.send("#{name}_path", prefix_options)
                mount_path == '/' ? '' : mount_path
              end
            end
          end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forgeos_core-1.9.5.rc2 lib/extensions/routing.rb
forgeos_core-1.9.5.rc1 lib/extensions/routing.rb