Sha256: 4454d1ecb7f596fb9dbf23815158880042e724fa9d92b4310c287171c73389ad

Contents?: true

Size: 999 Bytes

Versions: 6

Compression:

Stored size: 999 Bytes

Contents

module Redmineup
  module Patches
    module Compatibility
      module RoutingMapperPatch
        def self.included(base)
          base.send(:include, InstanceMethods)

          base.class_eval do
            alias_method :constraints_without_redmineup, :constraints
            alias_method :constraints, :constraints_with_redmineup
          end
        end

        module InstanceMethods
          def constraints_with_redmineup(options = {}, &block)
            return constraints_without_redmineup(options, &block) unless options.is_a?(Hash)

            options[:object_type] = /.+/ if options[:object_type] && options[:object_type].is_a?(Regexp)
            constraints_without_redmineup(options, &block)
          end
        end
      end
    end
  end
end

unless ActionDispatch::Routing::Mapper.included_modules.include?(Redmineup::Patches::Compatibility::RoutingMapperPatch)
  ActionDispatch::Routing::Mapper.send(:include, Redmineup::Patches::Compatibility::RoutingMapperPatch)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
redmineup-1.0.10 lib/redmineup/patches/compatibility/routing_mapper_patch.rb
redmineup-1.0.9 lib/redmineup/patches/compatibility/routing_mapper_patch.rb
redmineup-1.0.8 lib/redmineup/patches/compatibility/routing_mapper_patch.rb
redmineup-1.0.7 lib/redmineup/patches/compatibility/routing_mapper_patch.rb
redmineup-1.0.5 lib/redmineup/patches/compatibility/routing_mapper_patch.rb
redmineup-1.0.4 lib/redmineup/patches/compatibility/routing_mapper_patch.rb