actionpack 5.1.0.rc1 → 5.1.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -0
- data/lib/action_controller/api.rb +1 -0
- data/lib/action_controller/base.rb +7 -0
- data/lib/action_controller/metal.rb +1 -1
- data/lib/action_controller/metal/params_wrapper.rb +5 -1
- data/lib/action_controller/metal/request_forgery_protection.rb +5 -1
- data/lib/action_controller/metal/strong_parameters.rb +85 -30
- data/lib/action_controller/railtie.rb +4 -0
- data/lib/action_controller/test_case.rb +0 -1
- data/lib/action_dispatch/http/parameters.rb +2 -1
- data/lib/action_dispatch/routing.rb +0 -9
- data/lib/action_dispatch/routing/mapper.rb +2 -1
- data/lib/action_dispatch/routing/route_set.rb +1 -5
- data/lib/action_dispatch/routing/url_for.rb +3 -10
- data/lib/action_dispatch/system_test_case.rb +5 -6
- data/lib/action_pack/gem_version.rb +1 -1
- metadata +8 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e39f685ae0790d0a921d6c8671f476b177f76b5c
         | 
| 4 | 
            +
              data.tar.gz: a5df75af538dd2eddccbb78c9af25812095198bd
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: dc81f45547b89eb5d37c9bb0ccf95440693d323634beaaec56797bbfe6e706dd4913a5c8ae0bc92c82af526c829d9632e767570060607a6d12861172e67ae0f5
         | 
| 7 | 
            +
              data.tar.gz: a7d302843440b69b5596f99f5b1341697f577999599aca6563d7dc8a6d7f7f25beadc85928f4497eea8fac8f8da29101f8b0a6c699e9610ced9baf26d2a823fc
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,70 @@ | |
| 1 | 
            +
            ## Rails 5.1.0.rc2 (April 20, 2017) ##
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            *   Raise exception when calling `to_h` and `to_hash` in an unpermitted Parameters.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                Before we returned either an empty hash or only the always permitted parameters
         | 
| 6 | 
            +
                (`:controller` and `:action` by default).
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                The previous behavior was dangerous because in order to get the attributes users
         | 
| 9 | 
            +
                usually fallback to use `to_unsafe_h that` could potentially introduce security issues.
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                *Rafael Mendonça França*
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            *   Deprecate `config.action_controller.raise_on_unfiltered_parameters`.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                This option has no effect in Rails 5.1.
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                *Rafael Mendonça França*
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            *   Use more specific check for :format in route path
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                The current check for whether to add an optional format to the path is very lax
         | 
| 22 | 
            +
                and will match things like `:format_id` where there are nested resources, e.g:
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                ``` ruby
         | 
| 25 | 
            +
                resources :formats do
         | 
| 26 | 
            +
                  resources :items
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
                ```
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                Fix this by using a more restrictive regex pattern that looks for the patterns
         | 
| 31 | 
            +
                `(.:format)`, `.:format` or `/` at the end of the path. Note that we need to
         | 
| 32 | 
            +
                allow for multiple closing parenthesis since the route may be of this form:
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                ``` ruby
         | 
| 35 | 
            +
                get "/books(/:action(.:format))", controller: "books"
         | 
| 36 | 
            +
                ```
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                This probably isn't what's intended since it means that the default index action
         | 
| 39 | 
            +
                route doesn't support a format but we have a test for it so we need to allow it.
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                Fixes #28517.
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                *Andrew White*
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            *   Add `action_controller_api` and `action_controller_base` load hooks to be called in `ActiveSupport.on_load`
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                `ActionController::Base` and `ActionController::API` have differing implementations. This means that
         | 
| 48 | 
            +
                the one umbrella hook `action_controller` is not able to address certain situations where a method
         | 
| 49 | 
            +
                may not exist in a certain implementation.
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                This is fixed by adding two new hooks so you can target `ActionController::Base` vs `ActionController::API`
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                Fixes #27013.
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                *Julian Nadeau*
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            *   Don't include default headers in `ActionController::Metal` responses
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                The commit e16afe6 introduced an unintentional change of behavior where the default
         | 
| 60 | 
            +
                headers were included in responses from `ActionController::Metai` based controllers.
         | 
| 61 | 
            +
                This is now reverted to the previous behavior of having no default headers.
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                Fixes #25820.
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                *Jon Moss*
         | 
| 66 | 
            +
             | 
| 67 | 
            +
             | 
| 1 68 | 
             
            ## Rails 5.1.0.rc1 (March 20, 2017) ##
         | 
| 2 69 |  | 
| 3 70 | 
             
            *   Fix `NameError` raised in `ActionController::Renderer#with_defaults`
         | 
| @@ -261,6 +261,13 @@ module ActionController | |
| 261 261 | 
             
                  PROTECTED_IVARS
         | 
| 262 262 | 
             
                end
         | 
| 263 263 |  | 
| 264 | 
            +
                def self.make_response!(request)
         | 
| 265 | 
            +
                  ActionDispatch::Response.create.tap do |res|
         | 
| 266 | 
            +
                    res.request = request
         | 
| 267 | 
            +
                  end
         | 
| 268 | 
            +
                end
         | 
| 269 | 
            +
             | 
| 270 | 
            +
                ActiveSupport.run_load_hooks(:action_controller_base, self)
         | 
| 264 271 | 
             
                ActiveSupport.run_load_hooks(:action_controller, self)
         | 
| 265 272 | 
             
              end
         | 
| 266 273 | 
             
            end
         | 
| @@ -105,7 +105,11 @@ module ActionController | |
| 105 105 |  | 
| 106 106 | 
             
                      unless super || exclude
         | 
| 107 107 | 
             
                        if m.respond_to?(:attribute_names) && m.attribute_names.any?
         | 
| 108 | 
            -
                           | 
| 108 | 
            +
                          if m.respond_to?(:stored_attributes) && !m.stored_attributes.empty?
         | 
| 109 | 
            +
                            self.include = m.attribute_names + m.stored_attributes.values.flatten.map(&:to_s)
         | 
| 110 | 
            +
                          else
         | 
| 111 | 
            +
                            self.include = m.attribute_names
         | 
| 112 | 
            +
                          end
         | 
| 109 113 | 
             
                        end
         | 
| 110 114 | 
             
                      end
         | 
| 111 115 | 
             
                    end
         | 
| @@ -213,7 +213,11 @@ module ActionController #:nodoc: | |
| 213 213 |  | 
| 214 214 | 
             
                    if !verified_request?
         | 
| 215 215 | 
             
                      if logger && log_warning_on_csrf_failure
         | 
| 216 | 
            -
                         | 
| 216 | 
            +
                        if valid_request_origin?
         | 
| 217 | 
            +
                          logger.warn "Can't verify CSRF token authenticity."
         | 
| 218 | 
            +
                        else
         | 
| 219 | 
            +
                          logger.warn "HTTP Origin header (#{request.origin}) didn't match request.base_url (#{request.base_url})"
         | 
| 220 | 
            +
                        end
         | 
| 217 221 | 
             
                      end
         | 
| 218 222 | 
             
                      handle_unverified_request
         | 
| 219 223 | 
             
                    end
         | 
| @@ -43,6 +43,18 @@ module ActionController | |
| 43 43 | 
             
                end
         | 
| 44 44 | 
             
              end
         | 
| 45 45 |  | 
| 46 | 
            +
              # Raised when a Parameters instance is not marked as permitted and
         | 
| 47 | 
            +
              # an operation to transform it to hash is called.
         | 
| 48 | 
            +
              #
         | 
| 49 | 
            +
              #   params = ActionController::Parameters.new(a: "123", b: "456")
         | 
| 50 | 
            +
              #   params.to_h
         | 
| 51 | 
            +
              #   # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
         | 
| 52 | 
            +
              class UnfilteredParameters < ArgumentError
         | 
| 53 | 
            +
                def initialize # :nodoc:
         | 
| 54 | 
            +
                  super("unable to convert unpermitted parameters to hash")
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
             | 
| 46 58 | 
             
              # == Action Controller \Parameters
         | 
| 47 59 | 
             
              #
         | 
| 48 60 | 
             
              # Allows you to choose which attributes should be whitelisted for mass updating
         | 
| @@ -53,9 +65,9 @@ module ActionController | |
| 53 65 | 
             
              #
         | 
| 54 66 | 
             
              #   params = ActionController::Parameters.new({
         | 
| 55 67 | 
             
              #     person: {
         | 
| 56 | 
            -
              #       name:  | 
| 68 | 
            +
              #       name: "Francesco",
         | 
| 57 69 | 
             
              #       age:  22,
         | 
| 58 | 
            -
              #       role:  | 
| 70 | 
            +
              #       role: "admin"
         | 
| 59 71 | 
             
              #     }
         | 
| 60 72 | 
             
              #   })
         | 
| 61 73 | 
             
              #
         | 
| @@ -103,7 +115,7 @@ module ActionController | |
| 103 115 | 
             
              # You can fetch values of <tt>ActionController::Parameters</tt> using either
         | 
| 104 116 | 
             
              # <tt>:key</tt> or <tt>"key"</tt>.
         | 
| 105 117 | 
             
              #
         | 
| 106 | 
            -
              #   params = ActionController::Parameters.new(key:  | 
| 118 | 
            +
              #   params = ActionController::Parameters.new(key: "value")
         | 
| 107 119 | 
             
              #   params[:key]  # => "value"
         | 
| 108 120 | 
             
              #   params["key"] # => "value"
         | 
| 109 121 | 
             
              class Parameters
         | 
| @@ -203,13 +215,13 @@ module ActionController | |
| 203 215 | 
             
                #   class Person < ActiveRecord::Base
         | 
| 204 216 | 
             
                #   end
         | 
| 205 217 | 
             
                #
         | 
| 206 | 
            -
                #   params = ActionController::Parameters.new(name:  | 
| 218 | 
            +
                #   params = ActionController::Parameters.new(name: "Francesco")
         | 
| 207 219 | 
             
                #   params.permitted?  # => false
         | 
| 208 220 | 
             
                #   Person.new(params) # => ActiveModel::ForbiddenAttributesError
         | 
| 209 221 | 
             
                #
         | 
| 210 222 | 
             
                #   ActionController::Parameters.permit_all_parameters = true
         | 
| 211 223 | 
             
                #
         | 
| 212 | 
            -
                #   params = ActionController::Parameters.new(name:  | 
| 224 | 
            +
                #   params = ActionController::Parameters.new(name: "Francesco")
         | 
| 213 225 | 
             
                #   params.permitted?  # => true
         | 
| 214 226 | 
             
                #   Person.new(params) # => #<Person id: nil, name: "Francesco">
         | 
| 215 227 | 
             
                def initialize(parameters = {})
         | 
| @@ -228,13 +240,14 @@ module ActionController | |
| 228 240 | 
             
                end
         | 
| 229 241 |  | 
| 230 242 | 
             
                # Returns a safe <tt>ActiveSupport::HashWithIndifferentAccess</tt>
         | 
| 231 | 
            -
                # representation of  | 
| 243 | 
            +
                # representation of the parameters with all unpermitted keys removed.
         | 
| 232 244 | 
             
                #
         | 
| 233 245 | 
             
                #   params = ActionController::Parameters.new({
         | 
| 234 | 
            -
                #     name:  | 
| 235 | 
            -
                #     oddity:  | 
| 246 | 
            +
                #     name: "Senjougahara Hitagi",
         | 
| 247 | 
            +
                #     oddity: "Heavy stone crab"
         | 
| 236 248 | 
             
                #   })
         | 
| 237 | 
            -
                #   params.to_h | 
| 249 | 
            +
                #   params.to_h
         | 
| 250 | 
            +
                #   # => ActionController::UnfilteredParameters: unable to convert unfiltered parameters to hash
         | 
| 238 251 | 
             
                #
         | 
| 239 252 | 
             
                #   safe_params = params.permit(:name)
         | 
| 240 253 | 
             
                #   safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
         | 
| @@ -242,17 +255,61 @@ module ActionController | |
| 242 255 | 
             
                  if permitted?
         | 
| 243 256 | 
             
                    convert_parameters_to_hashes(@parameters, :to_h)
         | 
| 244 257 | 
             
                  else
         | 
| 245 | 
            -
                     | 
| 258 | 
            +
                    raise UnfilteredParameters
         | 
| 246 259 | 
             
                  end
         | 
| 247 260 | 
             
                end
         | 
| 248 261 |  | 
| 262 | 
            +
                # Returns a safe <tt>Hash</tt> representation of the parameters
         | 
| 263 | 
            +
                # with all unpermitted keys removed.
         | 
| 264 | 
            +
                #
         | 
| 265 | 
            +
                #   params = ActionController::Parameters.new({
         | 
| 266 | 
            +
                #     name: "Senjougahara Hitagi",
         | 
| 267 | 
            +
                #     oddity: "Heavy stone crab"
         | 
| 268 | 
            +
                #   })
         | 
| 269 | 
            +
                #   params.to_hash
         | 
| 270 | 
            +
                #   # => ActionController::UnfilteredParameters: unable to convert unfiltered parameters to hash
         | 
| 271 | 
            +
                #
         | 
| 272 | 
            +
                #   safe_params = params.permit(:name)
         | 
| 273 | 
            +
                #   safe_params.to_hash # => {"name"=>"Senjougahara Hitagi"}
         | 
| 274 | 
            +
                def to_hash
         | 
| 275 | 
            +
                  to_h.to_hash
         | 
| 276 | 
            +
                end
         | 
| 277 | 
            +
             | 
| 278 | 
            +
                # Returns a string representation of the receiver suitable for use as a URL
         | 
| 279 | 
            +
                # query string:
         | 
| 280 | 
            +
                #
         | 
| 281 | 
            +
                #   params = ActionController::Parameters.new({
         | 
| 282 | 
            +
                #     name: "David",
         | 
| 283 | 
            +
                #     nationality: "Danish"
         | 
| 284 | 
            +
                #   })
         | 
| 285 | 
            +
                #   params.to_query
         | 
| 286 | 
            +
                #   # => "name=David&nationality=Danish"
         | 
| 287 | 
            +
                #
         | 
| 288 | 
            +
                # An optional namespace can be passed to enclose key names:
         | 
| 289 | 
            +
                #
         | 
| 290 | 
            +
                #   params = ActionController::Parameters.new({
         | 
| 291 | 
            +
                #     name: "David",
         | 
| 292 | 
            +
                #     nationality: "Danish"
         | 
| 293 | 
            +
                #   })
         | 
| 294 | 
            +
                #   params.to_query("user")
         | 
| 295 | 
            +
                #   # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
         | 
| 296 | 
            +
                #
         | 
| 297 | 
            +
                # The string pairs "key=value" that conform the query string
         | 
| 298 | 
            +
                # are sorted lexicographically in ascending order.
         | 
| 299 | 
            +
                #
         | 
| 300 | 
            +
                # This method is also aliased as +to_param+.
         | 
| 301 | 
            +
                def to_query(*args)
         | 
| 302 | 
            +
                  to_h.to_query(*args)
         | 
| 303 | 
            +
                end
         | 
| 304 | 
            +
                alias_method :to_param, :to_query
         | 
| 305 | 
            +
             | 
| 249 306 | 
             
                # Returns an unsafe, unfiltered
         | 
| 250 | 
            -
                # <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of  | 
| 251 | 
            -
                #  | 
| 307 | 
            +
                # <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of the
         | 
| 308 | 
            +
                # parameters.
         | 
| 252 309 | 
             
                #
         | 
| 253 310 | 
             
                #   params = ActionController::Parameters.new({
         | 
| 254 | 
            -
                #     name:  | 
| 255 | 
            -
                #     oddity:  | 
| 311 | 
            +
                #     name: "Senjougahara Hitagi",
         | 
| 312 | 
            +
                #     oddity: "Heavy stone crab"
         | 
| 256 313 | 
             
                #   })
         | 
| 257 314 | 
             
                #   params.to_unsafe_h
         | 
| 258 315 | 
             
                #   # => {"name"=>"Senjougahara Hitagi", "oddity" => "Heavy stone crab"}
         | 
| @@ -297,7 +354,7 @@ module ActionController | |
| 297 354 | 
             
                #   class Person < ActiveRecord::Base
         | 
| 298 355 | 
             
                #   end
         | 
| 299 356 | 
             
                #
         | 
| 300 | 
            -
                #   params = ActionController::Parameters.new(name:  | 
| 357 | 
            +
                #   params = ActionController::Parameters.new(name: "Francesco")
         | 
| 301 358 | 
             
                #   params.permitted?  # => false
         | 
| 302 359 | 
             
                #   Person.new(params) # => ActiveModel::ForbiddenAttributesError
         | 
| 303 360 | 
             
                #   params.permit!
         | 
| @@ -319,7 +376,7 @@ module ActionController | |
| 319 376 | 
             
                # When passed a single key, if it exists and its associated value is
         | 
| 320 377 | 
             
                # either present or the singleton +false+, returns said value:
         | 
| 321 378 | 
             
                #
         | 
| 322 | 
            -
                #   ActionController::Parameters.new(person: { name:  | 
| 379 | 
            +
                #   ActionController::Parameters.new(person: { name: "Francesco" }).require(:person)
         | 
| 323 380 | 
             
                #   # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
         | 
| 324 381 | 
             
                #
         | 
| 325 382 | 
             
                # Otherwise raises <tt>ActionController::ParameterMissing</tt>:
         | 
| @@ -352,7 +409,7 @@ module ActionController | |
| 352 409 | 
             
                # Technically this method can be used to fetch terminal values:
         | 
| 353 410 | 
             
                #
         | 
| 354 411 | 
             
                #   # CAREFUL
         | 
| 355 | 
            -
                #   params = ActionController::Parameters.new(person: { name:  | 
| 412 | 
            +
                #   params = ActionController::Parameters.new(person: { name: "Finn" })
         | 
| 356 413 | 
             
                #   name = params.require(:person).require(:name) # CAREFUL
         | 
| 357 414 | 
             
                #
         | 
| 358 415 | 
             
                # but take into account that at some point those ones have to be permitted:
         | 
| @@ -382,7 +439,7 @@ module ActionController | |
| 382 439 | 
             
                # for the object to +true+. This is useful for limiting which attributes
         | 
| 383 440 | 
             
                # should be allowed for mass updating.
         | 
| 384 441 | 
             
                #
         | 
| 385 | 
            -
                #   params = ActionController::Parameters.new(user: { name:  | 
| 442 | 
            +
                #   params = ActionController::Parameters.new(user: { name: "Francesco", age: 22, role: "admin" })
         | 
| 386 443 | 
             
                #   permitted = params.require(:user).permit(:name, :age)
         | 
| 387 444 | 
             
                #   permitted.permitted?      # => true
         | 
| 388 445 | 
             
                #   permitted.has_key?(:name) # => true
         | 
| @@ -402,7 +459,7 @@ module ActionController | |
| 402 459 | 
             
                # You may declare that the parameter should be an array of permitted scalars
         | 
| 403 460 | 
             
                # by mapping it to an empty array:
         | 
| 404 461 | 
             
                #
         | 
| 405 | 
            -
                #   params = ActionController::Parameters.new(tags: [ | 
| 462 | 
            +
                #   params = ActionController::Parameters.new(tags: ["rails", "parameters"])
         | 
| 406 463 | 
             
                #   params.permit(tags: [])
         | 
| 407 464 | 
             
                #
         | 
| 408 465 | 
             
                # Sometimes it is not possible or convenient to declare the valid keys of
         | 
| @@ -418,11 +475,11 @@ module ActionController | |
| 418 475 | 
             
                #
         | 
| 419 476 | 
             
                #   params = ActionController::Parameters.new({
         | 
| 420 477 | 
             
                #     person: {
         | 
| 421 | 
            -
                #       name:  | 
| 478 | 
            +
                #       name: "Francesco",
         | 
| 422 479 | 
             
                #       age:  22,
         | 
| 423 480 | 
             
                #       pets: [{
         | 
| 424 | 
            -
                #         name:  | 
| 425 | 
            -
                #         category:  | 
| 481 | 
            +
                #         name: "Purplish",
         | 
| 482 | 
            +
                #         category: "dogs"
         | 
| 426 483 | 
             
                #       }]
         | 
| 427 484 | 
             
                #     }
         | 
| 428 485 | 
             
                #   })
         | 
| @@ -441,8 +498,8 @@ module ActionController | |
| 441 498 | 
             
                #   params = ActionController::Parameters.new({
         | 
| 442 499 | 
             
                #     person: {
         | 
| 443 500 | 
             
                #       contact: {
         | 
| 444 | 
            -
                #         email:  | 
| 445 | 
            -
                #         phone:  | 
| 501 | 
            +
                #         email: "none@test.com",
         | 
| 502 | 
            +
                #         phone: "555-1234"
         | 
| 446 503 | 
             
                #       }
         | 
| 447 504 | 
             
                #     }
         | 
| 448 505 | 
             
                #   })
         | 
| @@ -475,7 +532,7 @@ module ActionController | |
| 475 532 | 
             
                # Returns a parameter for the given +key+. If not found,
         | 
| 476 533 | 
             
                # returns +nil+.
         | 
| 477 534 | 
             
                #
         | 
| 478 | 
            -
                #   params = ActionController::Parameters.new(person: { name:  | 
| 535 | 
            +
                #   params = ActionController::Parameters.new(person: { name: "Francesco" })
         | 
| 479 536 | 
             
                #   params[:person] # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
         | 
| 480 537 | 
             
                #   params[:none]   # => nil
         | 
| 481 538 | 
             
                def [](key)
         | 
| @@ -494,11 +551,11 @@ module ActionController | |
| 494 551 | 
             
                # if more arguments are given, then that will be returned; if a block
         | 
| 495 552 | 
             
                # is given, then that will be run and its result returned.
         | 
| 496 553 | 
             
                #
         | 
| 497 | 
            -
                #   params = ActionController::Parameters.new(person: { name:  | 
| 554 | 
            +
                #   params = ActionController::Parameters.new(person: { name: "Francesco" })
         | 
| 498 555 | 
             
                #   params.fetch(:person)               # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
         | 
| 499 556 | 
             
                #   params.fetch(:none)                 # => ActionController::ParameterMissing: param is missing or the value is empty: none
         | 
| 500 | 
            -
                #   params.fetch(:none,  | 
| 501 | 
            -
                #   params.fetch(:none) {  | 
| 557 | 
            +
                #   params.fetch(:none, "Francesco")    # => "Francesco"
         | 
| 558 | 
            +
                #   params.fetch(:none) { "Francesco" } # => "Francesco"
         | 
| 502 559 | 
             
                def fetch(key, *args)
         | 
| 503 560 | 
             
                  convert_value_to_parameters(
         | 
| 504 561 | 
             
                    @parameters.fetch(key) {
         | 
| @@ -713,8 +770,6 @@ module ActionController | |
| 713 770 | 
             
                  end
         | 
| 714 771 | 
             
                end
         | 
| 715 772 |  | 
| 716 | 
            -
                undef_method :to_param
         | 
| 717 | 
            -
             | 
| 718 773 | 
             
                # Returns duplicate of object including all parameters.
         | 
| 719 774 | 
             
                def deep_dup
         | 
| 720 775 | 
             
                  self.class.new(@parameters.deep_dup).tap do |duplicate|
         | 
| @@ -22,6 +22,10 @@ module ActionController | |
| 22 22 | 
             
                initializer "action_controller.parameters_config" do |app|
         | 
| 23 23 | 
             
                  options = app.config.action_controller
         | 
| 24 24 |  | 
| 25 | 
            +
                  if options.delete(:raise_on_unfiltered_parameters)
         | 
| 26 | 
            +
                    ActiveSupport::Deprecation.warn("raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.")
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
             | 
| 25 29 | 
             
                  ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
         | 
| 26 30 | 
             
                  if app.config.action_controller[:always_permitted_parameters]
         | 
| 27 31 | 
             
                    ActionController::Parameters.always_permitted_parameters =
         | 
| @@ -115,6 +115,7 @@ module ActionDispatch | |
| 115 115 | 
             
              end
         | 
| 116 116 |  | 
| 117 117 | 
             
              module ParamsParser
         | 
| 118 | 
            -
                 | 
| 118 | 
            +
                include ActiveSupport::Deprecation::DeprecatedConstantAccessor
         | 
| 119 | 
            +
                deprecate_constant "ParseError", "ActionDispatch::Http::Parameters::ParseError"
         | 
| 119 120 | 
             
              end
         | 
| 120 121 | 
             
            end
         | 
| @@ -254,14 +254,5 @@ module ActionDispatch | |
| 254 254 |  | 
| 255 255 | 
             
                SEPARATORS = %w( / . ? ) #:nodoc:
         | 
| 256 256 | 
             
                HTTP_METHODS = [:get, :head, :post, :patch, :put, :delete, :options] #:nodoc:
         | 
| 257 | 
            -
             | 
| 258 | 
            -
                #:stopdoc:
         | 
| 259 | 
            -
                INSECURE_URL_PARAMETERS_MESSAGE = <<-MSG.squish
         | 
| 260 | 
            -
                  Attempting to generate a URL from non-sanitized request parameters!
         | 
| 261 | 
            -
             | 
| 262 | 
            -
                  An attacker can inject malicious data into the generated URL, such as
         | 
| 263 | 
            -
                  changing the host. Whitelist and sanitize passed parameters to be secure.
         | 
| 264 | 
            -
                MSG
         | 
| 265 | 
            -
                #:startdoc:
         | 
| 266 257 | 
             
              end
         | 
| 267 258 | 
             
            end
         | 
| @@ -54,6 +54,7 @@ module ActionDispatch | |
| 54 54 |  | 
| 55 55 | 
             
                  class Mapping #:nodoc:
         | 
| 56 56 | 
             
                    ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
         | 
| 57 | 
            +
                    OPTIONAL_FORMAT_REGEX = %r{(?:\(\.:format\)+|\.:format|/)\Z}
         | 
| 57 58 |  | 
| 58 59 | 
             
                    attr_reader :requirements, :defaults
         | 
| 59 60 | 
             
                    attr_reader :to, :default_controller, :default_action
         | 
| @@ -93,7 +94,7 @@ module ActionDispatch | |
| 93 94 | 
             
                    end
         | 
| 94 95 |  | 
| 95 96 | 
             
                    def self.optional_format?(path, format)
         | 
| 96 | 
            -
                      format != false &&  | 
| 97 | 
            +
                      format != false && path !~ OPTIONAL_FORMAT_REGEX
         | 
| 97 98 | 
             
                    end
         | 
| 98 99 |  | 
| 99 100 | 
             
                    def initialize(set, ast, defaults, controller, default_action, modyoule, to, formatted, scope_constraints, blocks, via, options_constraints, anchor, options)
         | 
| @@ -318,11 +318,7 @@ module ActionDispatch | |
| 318 318 | 
             
                              when Hash
         | 
| 319 319 | 
             
                                args.pop
         | 
| 320 320 | 
             
                              when ActionController::Parameters
         | 
| 321 | 
            -
                                 | 
| 322 | 
            -
                                  args.pop.to_h
         | 
| 323 | 
            -
                                else
         | 
| 324 | 
            -
                                  raise ArgumentError, ActionDispatch::Routing::INSECURE_URL_PARAMETERS_MESSAGE
         | 
| 325 | 
            -
                                end
         | 
| 321 | 
            +
                                args.pop.to_h
         | 
| 326 322 | 
             
                              end
         | 
| 327 323 | 
             
                            helper.call self, args, options
         | 
| 328 324 | 
             
                          end
         | 
| @@ -171,17 +171,10 @@ module ActionDispatch | |
| 171 171 | 
             
                    case options
         | 
| 172 172 | 
             
                    when nil
         | 
| 173 173 | 
             
                      _routes.url_for(url_options.symbolize_keys)
         | 
| 174 | 
            -
                    when Hash
         | 
| 174 | 
            +
                    when Hash, ActionController::Parameters
         | 
| 175 175 | 
             
                      route_name = options.delete :use_route
         | 
| 176 | 
            -
                       | 
| 177 | 
            -
             | 
| 178 | 
            -
                    when ActionController::Parameters
         | 
| 179 | 
            -
                      unless options.permitted?
         | 
| 180 | 
            -
                        raise ArgumentError.new(ActionDispatch::Routing::INSECURE_URL_PARAMETERS_MESSAGE)
         | 
| 181 | 
            -
                      end
         | 
| 182 | 
            -
                      route_name = options.delete :use_route
         | 
| 183 | 
            -
                      _routes.url_for(options.to_h.symbolize_keys.
         | 
| 184 | 
            -
                                      reverse_merge!(url_options), route_name)
         | 
| 176 | 
            +
                      merged_url_options = options.to_h.symbolize_keys.reverse_merge!(url_options)
         | 
| 177 | 
            +
                      _routes.url_for(merged_url_options, route_name)
         | 
| 185 178 | 
             
                    when String
         | 
| 186 179 | 
             
                      options
         | 
| 187 180 | 
             
                    when Symbol
         | 
| @@ -87,7 +87,7 @@ module ActionDispatch | |
| 87 87 |  | 
| 88 88 | 
             
                def initialize(*) # :nodoc:
         | 
| 89 89 | 
             
                  super
         | 
| 90 | 
            -
                  self.class. | 
| 90 | 
            +
                  self.class.driver.use
         | 
| 91 91 | 
             
                end
         | 
| 92 92 |  | 
| 93 93 | 
             
                def self.start_application # :nodoc:
         | 
| @@ -100,6 +100,8 @@ module ActionDispatch | |
| 100 100 | 
             
                  SystemTesting::Server.new.run
         | 
| 101 101 | 
             
                end
         | 
| 102 102 |  | 
| 103 | 
            +
                class_attribute :driver, instance_accessor: false
         | 
| 104 | 
            +
             | 
| 103 105 | 
             
                # System Test configuration options
         | 
| 104 106 | 
             
                #
         | 
| 105 107 | 
             
                # The default settings are Selenium, using Chrome, with a screen size
         | 
| @@ -113,13 +115,10 @@ module ActionDispatch | |
| 113 115 | 
             
                #
         | 
| 114 116 | 
             
                #   driven_by :selenium, screen_size: [800, 800]
         | 
| 115 117 | 
             
                def self.driven_by(driver, using: :chrome, screen_size: [1400, 1400], options: {})
         | 
| 116 | 
            -
                   | 
| 118 | 
            +
                  self.driver = SystemTesting::Driver.new(driver, using: using, screen_size: screen_size, options: options)
         | 
| 117 119 | 
             
                end
         | 
| 118 120 |  | 
| 119 | 
            -
                 | 
| 120 | 
            -
                def self.driver
         | 
| 121 | 
            -
                  @driver ||= SystemTestCase.driven_by(:selenium)
         | 
| 122 | 
            -
                end
         | 
| 121 | 
            +
                driven_by :selenium
         | 
| 123 122 | 
             
              end
         | 
| 124 123 |  | 
| 125 124 | 
             
              SystemTestCase.start_application
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: actionpack
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5.1.0. | 
| 4 | 
            +
              version: 5.1.0.rc2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Heinemeier Hansson
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-04-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - '='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 5.1.0. | 
| 19 | 
            +
                    version: 5.1.0.rc2
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - '='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 5.1.0. | 
| 26 | 
            +
                    version: 5.1.0.rc2
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: rack
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -92,28 +92,28 @@ dependencies: | |
| 92 92 | 
             
                requirements:
         | 
| 93 93 | 
             
                - - '='
         | 
| 94 94 | 
             
                  - !ruby/object:Gem::Version
         | 
| 95 | 
            -
                    version: 5.1.0. | 
| 95 | 
            +
                    version: 5.1.0.rc2
         | 
| 96 96 | 
             
              type: :runtime
         | 
| 97 97 | 
             
              prerelease: false
         | 
| 98 98 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 99 99 | 
             
                requirements:
         | 
| 100 100 | 
             
                - - '='
         | 
| 101 101 | 
             
                  - !ruby/object:Gem::Version
         | 
| 102 | 
            -
                    version: 5.1.0. | 
| 102 | 
            +
                    version: 5.1.0.rc2
         | 
| 103 103 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 104 104 | 
             
              name: activemodel
         | 
| 105 105 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 106 106 | 
             
                requirements:
         | 
| 107 107 | 
             
                - - '='
         | 
| 108 108 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            -
                    version: 5.1.0. | 
| 109 | 
            +
                    version: 5.1.0.rc2
         | 
| 110 110 | 
             
              type: :development
         | 
| 111 111 | 
             
              prerelease: false
         | 
| 112 112 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 113 113 | 
             
                requirements:
         | 
| 114 114 | 
             
                - - '='
         | 
| 115 115 | 
             
                  - !ruby/object:Gem::Version
         | 
| 116 | 
            -
                    version: 5.1.0. | 
| 116 | 
            +
                    version: 5.1.0.rc2
         | 
| 117 117 | 
             
            description: Web apps on Rails. Simple, battle-tested conventions for building and
         | 
| 118 118 | 
             
              testing MVC web applications. Works with any Rack-compatible server.
         | 
| 119 119 | 
             
            email: david@loudthinking.com
         |