Flowdock
method

normalize_conditions!

Importance_0
Ruby on Rails latest stable (v4.1.8) - 0 notes - Class: ActionDispatch::Routing::Mapper::Mapping
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 171
          def normalize_conditions!
            @conditions[:path_info] = path

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

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

            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]
              @conditions[:request_method] = Array(via).map { |m| m.to_s.dasherize.upcase }
            end
          end
Register or log in to add new notes.