Flowdock
method

normalize_conditions!

Importance_0
v4.0.2 - Show latest stable - 0 notes - Class: ActionDispatch::Routing::Mapper::Mapping
  • 1.0.0
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2 (0)
  • 4.1.8 (0)
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1
  • 5.1.7
  • 5.2.3
  • 6.0.0
  • 6.1.3.1
  • 6.1.7.7
  • 7.0.0
  • 7.1.3.2
  • What's this?
normalize_conditions!() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 168
          def normalize_conditions!
            @conditions.merge!(:path_info => path)

            constraints.each do |key, condition|
              next if segment_keys.include?(key) || key == :controller
              @conditions[key] = condition
            end

            @conditions[:required_defaults] = []
            options.each do |key, required_default|
              next if segment_keys.include?(key) || IGNORE_OPTIONS.include?(key)
              next if Regexp === required_default
              @conditions[:required_defaults] << key
            end

            via_all = options.delete(:via) if options[:via] == :all

            if !via_all && options[:via].blank?
              msg = "You should not use the `match` method in your router without specifying an HTTP method.\n"                      "If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.\n"                      "If you want to expose your action to GET, use `get` in the router:\n"                      "  Instead of: match \"controller#action\"\n"                      "  Do: get \"controller#action\""
              raise msg
            end

            if via = options[:via]
              list = Array(via).map { |m| m.to_s.dasherize.upcase }
              @conditions.merge!(:request_method => list)
            end
          end
Register or log in to add new notes.