- 30 11月, 2016 1 次提交
-
-
由 Daniel Carral 提交于
[ci skip]
-
- 13 11月, 2016 2 次提交
-
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
This alternative case expressions read better for my taste, and look more uniform in a file where other similar case expressions are used (without dynamic clauses).
-
- 12 11月, 2016 3 次提交
-
-
由 Xavier Noria 提交于
The current implementation of AC::Parameters#permit builds permitted hashes and then calls permit! on them. This filtering is recursive, so we call permit! on terminal branches, but then ascendants call permit! on themselves when the recursion goes up the stack, which recurses all the way down again because permit! is recursive itself. Repeat this for every parent node and you get some scary O-something going on that I don't even want to compute. Instead, since the whole point of the permit recursion is to build permitted hashes along the way and at that point you know you've just come up with a valid filtered version, you can already switch the toggle on the spot. I have seen 2x speedups in casual benchmarks with small structures. As the previous description shows, the difference in performance is going to be a function of the nesting. Note that that the involved methods are private and used only by permit.
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
-
- 29 10月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 27 10月, 2016 1 次提交
-
-
由 bogdanvlviv 提交于
Mainly around `nil` [ci skip]
-
- 18 10月, 2016 1 次提交
-
-
由 yuuji.yaginuma 提交于
This method has the same behavior as `Hash#merge!`, returns current `ActionController::Parameters`.
-
- 11 10月, 2016 1 次提交
-
-
由 Pavel Evstigneev 提交于
* ActionController::Parameters#deep_dup * Tests for ActionController::Parameters#deep_dup * Fix test for ActionController::Parameters#deep_dup * More tests for ActionController::Parameters#deep_dup [Rafael Mendonça França + Pavel Evstigneev]
-
- 10 10月, 2016 2 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
-
- 07 9月, 2016 1 次提交
-
-
由 yuuji.yaginuma 提交于
`ActionController::Parameters#merge` call `HashWithIndifferentAccess#merge`. In addition, it calls `HashWithIndifferentAccess#update` from `HashWithIndifferentAccess#merge`, where it is called the `#to_hash` of argument. But `ActionController::Parameters#to_hash` is deprecated, warning message is displayed. To avoid this, modify to convert object to `Hash`. Fixes #26415
-
- 01 9月, 2016 1 次提交
-
-
由 Kasper Timm Hansen 提交于
Makes it clearer why we're doing this Add a comment to elaborate on what the undef means and move it closer to the deprecations so it's less likely for whoever pulls the deprecations that it should go too.
-
- 31 8月, 2016 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 16 8月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
-
- 10 8月, 2016 1 次提交
-
-
由 Igor Kasyanchuk 提交于
-
- 08 8月, 2016 1 次提交
-
-
由 Xavier Noria 提交于
A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
-
- 07 8月, 2016 1 次提交
-
-
由 Xavier Noria 提交于
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
-
- 02 8月, 2016 4 次提交
-
-
由 Kasper Timm Hansen 提交于
Looked odd, so completely detached from the other necessary part of the implementation.
-
由 Kasper Timm Hansen 提交于
The coder that Psych passes in has a `tag` method we can use to detect which serialization format we're reviving for. Use it and make it clearer alongside the `load_tags` fiddling.
-
由 Kasper Timm Hansen 提交于
If we were to serialize an `ActionController::Parameters` on Psych 2.0.8, we'd get: ```yaml --- !ruby/hash:ActionController::Parameters key: :value ``` Because 2.0.8 didn't store instance variables, while 2.0.9 did: https://github.com/tenderlove/psych/commit/8f84ad0fc711a82a1040def861cb121e8985fd4c That, coupled with 2.0.8 calling `new` instead of `allocate` meant parameters was deserialized just fine: https://github.com/tenderlove/psych/commit/af308f8307899cb9e1c0fffea4bce3110a1c3926 However, if users have 2.0.8 serialized parameters, then upgrade to Psych 2.0.9+ and Rails 5, it would start to blow up because `initialize` will never be called, and thus `@parameters` will never be assigned. Hello, `NoMethodErrors` on `NilClass`! :) To fix this we register another variant of the previous serialization format and take it into account in `init_with`. I've tested this in our app and previously raising code now deserializes like a champ. I'm unsure how to test this in our suite because we use Psych 2.0.8 and don't know how to make us use 2.0.9+ for just one test.
-
由 Kasper Timm Hansen 提交于
By changing ActionController::Parameter's superclass, Rails 5 also changed the YAML serialization format. Since YAML doesn't know how to handle parameters it would fallback to its routine for the superclass, which in Rails 4.2 was Hash while just Object in Rails 5. As evident in the tags YAML would spit out: 4.2: !ruby/hash-with-ivars:ActionController::Parameters 5.0: !ruby/object:ActionController::Parameters Thus when loading parameters YAML from 4.2 in Rails 5, it would parse a hash dump as it would an Object class. To fix this we have to provide our own `init_with` to be aware of the past format as well as the new one. Then we add a `load_tags` mapping, such that when the YAML parser sees `!ruby/hash-with-ivars:ActionController::Parameters`, it knows to call our `init_with` function and not try to instantiate it as a normal hash subclass.
-
- 09 7月, 2016 1 次提交
-
-
由 Tim Rogers 提交于
Trust `Object#dup` in `ActionController::Parameters`, using `#initialize_copy` to manually duplicate the underlying parameters hash It looks like `ActionController::Parameters#dup` is leftover from when the class inherited from `Hash`. We can just trust `#dup`, which already copies the `@permitted` instance variable (confirmed by tests). We still define a `#initialize_copy` to make `@parameters` a copy that can be mutated without affecting the original instance.
-
- 07 7月, 2016 1 次提交
-
-
由 Tim Rogers 提交于
When `ActionController::Parameters` is duplicated with `#dup`, it doesn't create a duplicate of the instance variables (e.g. `@parameters`) but rather maintains the reference (see <http://ruby-doc.org/core-2.3.1/Object.html>). Given that the parameters object is often manipulated as if it were a hash (e.g. with `#delete` and similar methods), this leads to unexpected behaviour, like the following: ``` params = ActionController::Parameters.new(foo: "bar") duplicated_params = params.dup duplicated_params.delete(:foo) params == duplicated_params ``` This fixes the bug by defining a private `#initialize_copy` method, used internally by `#dup`, which makes a copy of `@parameters`.
-
- 23 6月, 2016 2 次提交
-
-
由 Jon Moss 提交于
In the docs: "+permit_all_parameters+ - If it's +true+, all the parameters will be permitted by default. The default is +false+."
-
由 Benjamin Quorning 提交于
The changes in this commit are twofold: 1. The examples showing `#require` accepting two arguments were wrong - you have to wrap the arguments (two, or more) in an array. 2. `ActionController::Parameters` has an `#inspect` method now (since https://github.com/rails/rails/pull/23732), and the documentation should reflect that.
-
- 29 5月, 2016 1 次提交
-
-
由 Christian Wesselhoeft 提交于
This example code wasn't getting wrapped in a `<code>` tag due to incorrect indentation.
-
- 28 5月, 2016 1 次提交
-
-
由 yuuji.yaginuma 提交于
-
- 01 5月, 2016 1 次提交
-
-
由 Tom Kadwill 提交于
-
- 15 4月, 2016 1 次提交
-
-
由 Sean Griffin 提交于
This brings the behavior more inline with other similar cases, such as receiving a hash when an array of scalars was expected. Prior to this commit, the key would be present, but the value would be `nil`
-
- 24 3月, 2016 1 次提交
-
-
由 Prathamesh Sonpatki 提交于
- Added missing `"`.
-
- 13 3月, 2016 1 次提交
-
-
由 Bart de Water 提交于
Add explanation about accepts_nested_attributes_for keys in the strong parameters documentation [skip ci]
-
- 12 3月, 2016 1 次提交
-
-
由 Gaurish Sharma 提交于
[ci-skip]
-
- 10 3月, 2016 2 次提交
-
-
由 yuuji.yaginuma 提交于
-
由 Sean Griffin 提交于
This method will only be added when used with Ruby 2.3.0 or greater. This method has the same behavior as `Hash#dig`, except it will convert hashes to `ActionController::Parameters`, similar to `#[]` and `#fetch`.
-
- 24 2月, 2016 1 次提交
-
-
由 Prathamesh Sonpatki 提交于
- Fixes #23822.
-
- 19 2月, 2016 2 次提交
-
-
由 Benjamin Quorning 提交于
-
由 Benjamin Quorning 提交于
Creating a protected getter method for `@parameters`.
-
- 18 2月, 2016 1 次提交
-
-
由 Aaron Patterson 提交于
While iterating an AC::Parameters object, the object will mutate itself and stick AC::Parameters objects where there used to be hashes: https://github.com/rails/rails/blob/f57092ad728fa1de06c4f5fd9d09dcc2c4738fd9/actionpack/lib/action_controller/metal/strong_parameters.rb#L632 If you use `permit` after this iteration, the `fields_for_style` method wouldn't return true because the child objects are now AC::Parameters objects rather than Hashes. fixes #23701
-