Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rails/rails
...
head fork: rails/rails
This comparison is big! We’re only showing the most recent 250 commits
Commits on Jul 09, 2015
@tenderlove tenderlove set parameters as a query string
We should convert request parameters to a query string, then let the
request object parse that query string.  This should give us results
that are more similar to the real-world
394b7be
@tenderlove tenderlove use `Rack::Test::UploadedFile` when uploading files
We should use rack-test's upload file objects on the test side so that
we will be able to correctly generate mime blob posts in the future
140d5a3
@kaspth kaspth Merge pull request #20813 from noniq/locale-argument-for-pluralize-he…
…lper

Allow `pluralize` helper to take a locale.
87b4f31
@ronakjangir47 ronakjangir47 Removed use of mocha in active_support 2f28e5b
@kaspth kaspth Merge pull request #20457 from ronakjangir47/remove_mocha_activesupport
Removed use of mocha in Active Support
d37f01b
@tenderlove tenderlove drop runtime conditionals in parameter parsing
If we only deal with proc objects, then we can eliminate type checking
in the parameter parsing middleware
eb10496
Commits on Jul 10, 2015
@mcfiredrill mcfiredrill [ci skip] change sentence about reporting bugs in contributing guide
I think I know what this sentence is trying to say, but the sentence
didn't really make sense, bugs don't fix things! How about this take on
it? :sweat_smile:
f0e922f
@mcfiredrill mcfiredrill saying that "behaviour" "behaves" is kind of awkward, how about "works"
5c3db80
@Sirupsen Sirupsen active_support/indifferent_hash: fix cloning default_proc on dup 4ff255a
@Sirupsen Sirupsen active_support/indifferent_hash: dont raise on to_hash when default_p…
…roc raises
fa30dd6
@Sirupsen Sirupsen test/hash: move lonely indifferent hash test 9578d57
@rafaelfranca rafaelfranca Merge pull request #20828 from Sirupsen/hash-indifferent-dup-default-…
…proc

active_support/indifferent_access: fix not raising when default_proc does
ebf8961
@rafaelfranca rafaelfranca Reuse the same test for HWIA reverse_merge! fabcdc7
@tenderlove tenderlove drop a conditional by always assigning
We will always make an assignment to the env hash and eliminate a
conditional
a1d7d65
@tenderlove tenderlove start disconnecting the parameter parser from the instance
pass in the instance variable to start decoupling the meat of the parser
from the instance of the middleware
f3bae24
@sikachu sikachu Require yaml for time_with_zone isolation test
Same fix as 109e71d but after
mocha got removed in 2f28e5b.
2f26f61
@rafaelfranca rafaelfranca Merge pull request #20836 from sikachu/fix-time-zone-test
Require yaml for time_with_zone isolation test
7161855
@tenderlove tenderlove encode / decode parameters before assigning them to the request
We should roundtrip the parameters through their respective encoders /
decoders so that the controller will get parameters similar to what they
actually get in a real world situation
c546a2b
@tenderlove tenderlove remove param dup'ing logic
since we are serializing parameters, we don't need to do all the dup
checks on each object.
79ab812
@tenderlove tenderlove no more HWIA
non_path_parameters is used internally (it never escapes this method) so
we should be able to safely use a regular hash.
11bc078
@tenderlove tenderlove Parameters are converted to a query string
Since parameters are converted to a query string, they will
automatically be turned in to strings by the query parser
0adb8f8
@tenderlove tenderlove start collecting `env` mutations
I'd like to put all env mutations together so we can understand how to
change this code to call `call` on the controller
f1fcf9b
@tenderlove tenderlove call the `path_parameters=` setter rather than rely on mutations
We should call the setter on `path_parameters` so that we know the hash
will only contain the values that we've set.
314ac0c
@tenderlove tenderlove remove useless ivar clearing
Since we only work with new instances, these ivars will not be set.
889a4a3
@tenderlove tenderlove always default the SCRIPT_NAME to whatever is on the controller 8b4eca0
@tenderlove tenderlove default `PATH_INFO` to the generated path
we were already generating a path in the previous code (it was just not
returned), so lets just use the already computed path to popluate the
PATH_INFO header
e459b29
@tenderlove tenderlove Remove useless conditional
PATH_INFO is already set, so this branch will never execute.
85903d1
@tenderlove tenderlove we don't really need an extra method to set the script name 3c5bd78
@kaspth kaspth Add multiple expected calls to assert_called_with. 46b92c4
@kaspth kaspth Use private method call assertions in Active Model tests.
Also fix Minitest constant reference.
8a389ff
@kaspth kaspth Require yaml for time_zone isolation test.
See 2f26f61 for more info.
17a6e60
@tenderlove tenderlove Merge pull request #17102 from matthewd/load-interlock
Concurrent load interlock (rm Rack::Lock)
8f81f7a
@kaspth kaspth Require yaml for XML mini isolation test. 57ab74c
@TheBlasfem TheBlasfem improve duplicable documentation [ci skip] d1630c3
@tenderlove tenderlove remove Rack::Lock for webrick
constant loading should be thread safe now, so lets remove this
cc60b5e
Commits on Jul 11, 2015
@zamith zamith Remove the reference to mocha in activemodel
Activemodel is no longer dependent on mocha, so we can make the comments
more generic.
ec7771e
@mcfiredrill mcfiredrill the key is that the behavior is incorrect [ci skip] 4edaa88
@claudiob claudiob Merge pull request #20843 from zamith/activemodel-remove-mocha
Remove the reference to mocha in activemodel
6eca1fd
@kaspth kaspth Merge pull request #20838 from TheBlasfem/improve_duplicable_document…
…ation

Improve duplicable documentation [ci skip]
a6d7460
@fxn fxn Merge pull request #20832 from mcfiredrill/contributing-to-rails-bugs…
…-arent-fixes

[ci skip] change sentence about reporting bugs in contributing guide
169a747
@y-yagi y-yagi fix class name typo [ci skip] 0a483eb
@kaspth kaspth Merge pull request #20845 from y-yagi/fix_typo_in_changelog
fix class name typo [ci skip]
c35c0c4
@zamith zamith Removes unnecessary comments from i18n validations tests [ci skip]
These comments do not add a lot to the readability, grepability or
overall understanding of the tests, therefore I believe they can be
safely removed.
a9ab7e8
@seuros seuros Merge pull request #20847 from zamith/cleanup-am-tests
Removes unnecessary comments from i18n validations tests [ci skip]
b0506e2
@vijaydev vijaydev Merge branch 'master' of github.com:rails/docrails 14354f1
@chancancode chancancode Add tests to ensure we don't interfere with json gem's output 2926d73
@chancancode chancancode Expand the JSON test coverage for Struct and Hash (?!) 696a19f
@chancancode chancancode Expand coverage of JSON gem tests a6b2ace
@chancancode chancancode Merge branch 'json-gem-tests' 794252d
Commits on Jul 12, 2015
@TheBlasfem TheBlasfem added description instead of remove usage [ci skip] 789a2df
@claudiob claudiob Merge pull request #20842 from TheBlasfem/removed_usage_lines_docs
Removed usage line docs [ci skip]
e0a7e7b
@y-yagi y-yagi make test runner work correctly inside engine 824246f
@hedgesky hedgesky fix typo in caching guide [ci skip] 0d7185d
@kaspth kaspth Merge pull request #20852 from hedgesky/fix_typo_in_caching_guide
fix typo in caching guide [ci skip]
08e41a0
Commits on Jul 13, 2015
@antoine-lizee antoine-lizee [ci skip] doc: making clear that perform_caching has a limited impact 89a55ed
@jdantonio jdantonio Replaced `ActiveSupport::Concurrency::Latch` with concurrent-ruby.
The concurrent-ruby gem is a toolset containing many concurrency
utilities. Many of these utilities include runtime-specific
optimizations when possible. Rather than clutter the Rails codebase with
concurrency utilities separate from the core task, such tools can be
superseded by similar tools in the more specialized gem. This commit
replaces `ActiveSupport::Concurrency::Latch` with
`Concurrent::CountDownLatch`, which is functionally equivalent.
284a9ba
@rafaelfranca rafaelfranca Remove JRuby and Rubinius from the travis matrix
This will save Travis some precious resource since it will not need to
run 18 jobs for these Ruby implementations on every push or pull
request.

We do care about these implementations but we should fix the build
locally before having it running on travis. We would love to have
someone working on this but right now it is not our reality.
0e8c045
@robin850 robin850 Merge pull request #20736 from antoine-lizee/docs
[ci skip] docs: making clear that perform_caching has a limited impact
4860942
Commits on Jul 14, 2015
@tenderlove tenderlove move buffer caching on to the buffer b37e29e
@tenderlove tenderlove only have one TestResponse class d9fe10c
@tenderlove tenderlove use a lookup table for `assert_response`
We shouldn't depend on specific methods imlemented in the TestResponse
subclass because the response could actually be a real response object.

In the future, we should either push the aliased predicate methods in
TestResponse up to the real response object, or remove them
908bc79
@kaspth kaspth Merge pull request #20870 from y-yagi/test_runner_inside_engine
make test runner work correctly inside engine
368b993
@sikachu sikachu Change AC::TestResponse to AD::TestResponse
ActionController::TestResponse was removed in d9fe10c and caused a test
failure on Action View as its test case still refers to it.
e26d11c
@tenderlove tenderlove only call methods that are on the superclass
We want to treat the response object as if it's a real response object
(not a test object), so we should only call methods that are on the
superclass.
9cff248
@rafaelfranca rafaelfranca Merge pull request #20877 from sikachu/rename-ac-test_response
Change AC::TestResponse to AD::TestResponse
7645a5f
@tenderlove tenderlove Merge pull request #20866 from jdantonio/countdown-latch
Replace `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch` from concurrent-ruby.
468a55b
@rafaelfranca rafaelfranca Remove concurrent-ruby from Action Pack gemspec
It is already on Active Support
8aadbeb
@rafaelfranca rafaelfranca Fix Gemfile.lock 9dc06bc
@tenderlove tenderlove Rack implements `redirect?` so we don't need it
Rack [already implements `redirect?` on the response object](https://github.com/rack/rack/blob/1569a985e17d9caaf94d0e97d95ef642c4ab14ba/lib/rack/response.rb#L141) so we don't need to implement our own.
4d4d764
Commits on Jul 15, 2015
@aditya-kapoor aditya-kapoor [ci skip] add note for individual stub creation a413111
@robin850 robin850 Merge pull request #20812 from aditya-kapoor/close-20694
[ci skip] add note for individual stub creation
a0b4dc2
@sikachu sikachu Make AC::Parameters not inherited from Hash
This is another take at #14384 as we decided to wait until `master` is
targeting Rails 5.0. This commit is implementation-complete, as it
guarantees that all the public methods on the hash-inherited Parameters
are still working (based on test case). We can decide to follow-up later
if we want to remove some methods out from Parameters.
14a3bd5
@tgxworld tgxworld Revert "Revert "Reduce allocations when running AR callbacks.""
This reverts commit bdc1d32.

Before:
Calculating -------------------------------------
                        22.000  i/100ms
-------------------------------------------------
                        229.700  (± 0.4%) i/s -      1.166k
Total Allocated Object: 9939

After:
Calculating -------------------------------------
                        24.000  i/100ms
-------------------------------------------------
                        246.443  (± 0.8%) i/s -      1.248k
Total Allocated Object: 7939

```
begin
  require 'bundler/inline'
rescue LoadError => e
  $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
  raise e
end

gemfile(true) do
  source 'https://rubygems.org';
  # gem 'rails', github: 'rails/rails', ref: 'bdc1d329d4eea823d07cf010064bd19c07099ff3'
  gem 'rails', github: 'rails/rails', ref: 'd2876141d08341ec67cf6a11a073d1acfb920de7'
  gem 'arel', github: 'rails/arel'
  gem 'sqlite3'
  gem 'benchmark-ips'
end

require 'active_record'
require 'benchmark/ips'

ActiveRecord::Base.establish_connection('sqlite3::memory:')

ActiveRecord::Migration.verbose = false

ActiveRecord::Schema.define do
  create_table :users, force: true do |t|
    t.string :name, :email
    t.boolean :admin
    t.timestamps null: false
  end
end

class User < ActiveRecord::Base
  default_scope { where(admin: true) }
end

admin = true

1000.times do
  attributes = {
    name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    email: "foobar@email.com",
    admin: admin
  }

  User.create!(attributes)

  admin = !admin
end

GC.disable

Benchmark.ips(5, 3) do |x|
  x.report { User.all.to_a }
end

key =
  if RUBY_VERSION < '2.2'
    :total_allocated_object
  else
    :total_allocated_objects
  end

before = GC.stat[key]
User.all.to_a
after = GC.stat[key]
puts "Total Allocated Object: #{after - before}"
```
beb07fb
@sikachu sikachu Update documentation on `AC::Parameters` 84b861f
@rafaelfranca rafaelfranca Merge pull request #20887 from tgxworld/ar_callbacks
Revert "Revert "Reduce allocations when running AR callbacks.""
64c1264
@sikachu sikachu Deprecate force association reload by passing true
This is to simplify the association API, as you can call `reload` on the
association proxy or the parent object to get the same result.

For collection association, you can call `#reload` on association proxy
to force a reload:

    @user.posts.reload   # Instead of @user.posts(true)

For singular association, you can call `#reload` on the parent object to
clear its association cache then call the association method:

    @user.reload.profile   # Instead of @user.profile(true)

Passing a truthy argument to force association to reload will be removed
in Rails 5.1.
6eae366
@rafaelfranca rafaelfranca Merge pull request #20868 from sikachu/params-not-inherited-from-hwia
Make AC::Parameters not inherited from Hash
4f21269
@rafaelfranca rafaelfranca Merge pull request #20888 from sikachu/remove-support-for-force-reload
Deprecate force association reload by passing true
424b379
Commits on Jul 16, 2015
@zoltankiss zoltankiss Standardize `ActionController::Parameters#to_unsafe_h` return value
`ActionController::Parameters#to_h` returns a hash, so lets have
`ActionController::Parameters#to_unsafe_h` return a hash instead of
an `ActiveSupport::HashWithIndifferentAccess` for consistency.
ea6e7ff
@rafaelfranca rafaelfranca Merge pull request #20892 from zoltankiss/make-params-method-returns-…
…consistent

Standardize `ActionController::Parameters#to_unsafe_h` return value
094571b
@brian-davis brian-davis grammar fix to content_for method documentation in capture_helper.rb
5334889
@sikachu sikachu Silence deprecation warning from force reload
We deprecate the support for passing an argument to force reload in
6eae366. That led to several
deprecation warning when running Active Record test suite.

This commit silence the warnings by properly calling `#reload` on the
association proxy or on the association object instead. However, there
are several places that `ActiveSupport::Deprecation.silence` are used as
those tests actually tests the force reload functionality and will be
removed once `master` is targeted next minor release (5.1).
b5b8979
@imtayadeway imtayadeway [skip ci] Improve grammar/style in DB pooling guide. dffd91c
@maurogeorge maurogeorge Add a note about default_scope and create records
[ci skip]
2ef1de0
Commits on Jul 17, 2015
@yui-knk yui-knk [ci skip] Add `bundle exec` to test run command 2312ea5
@amatsuda amatsuda "warning: instance variable @routes not initialized" 8b3c683
@amatsuda amatsuda Oops! :bomb: 022c676
@claudiob claudiob Merge pull request #20905 from imtayadeway/tw/fix-db-pooling-docs
[skip ci] Improve grammar/style in DB pooling guide.
607dfb6
@claudiob claudiob Merge pull request #20909 from yui-knk/fix/test-commnad
[ci skip] Add `bundle exec` to test run command
e5bfe71
@robin850 robin850 Skip a few failing tests on JRuby with the attached tickets ae1b96c
@sgrif sgrif Merge pull request #20915 from robin850/jruby-skips
Skip a few failing tests on JRuby with the attached tickets
2c79122
@jonatack jonatack [skip ci] Lookup can be a noun but it is not a verb
Various grammar corrections and wrap to 80 characters.
ea747f7
@rafaelfranca rafaelfranca Merge pull request #20918 from jonatack/fix-lookup-grammar
[skip ci] Lookup can be a noun but it is not a verb
8c147bc
@tenderlove tenderlove push key checking up
We should disconnect `array_of_permitted_scalars_filter` from the
instance so that we can make hash filtering functional.  For now, pull
the conditional up out of that method
55d0e6f
@tenderlove tenderlove stop passing `params` to `array_of_permitted_scalars_filter`
this way the method doesn't have to know what the new params object is,
it just yields to a block.  This change also caches the value of
`self[key]` on the stack
2df8e86
@tenderlove tenderlove remove useless function
Now that the value is cached on the stack,
`array_of_permitted_scalars_filter` is exactly the same as
`array_of_permitted_scalars?`, so lets just have one
cb3f255
@tenderlove tenderlove remove useless conditionals
`element` can never be a hash because:

1. `slice` returns a Parameters object and calls each on it: https://github.com/rails/rails/blob/cb3f25593b1137e344086364d4b1a52c08e8eb3b/actionpack/lib/action_controller/metal/strong_parameters.rb#L656
2. `each` which is implemented by `each_pair` will call `convert_hashes_to_parameters` on the value: https://github.com/rails/rails/blob/cb3f25593b1137e344086364d4b1a52c08e8eb3b/actionpack/lib/action_controller/metal/strong_parameters.rb#L192-197
3. `convert_hashes_to_parameters` will convert any hash objects in to parameters objects: https://github.com/rails/rails/blob/cb3f25593b1137e344086364d4b1a52c08e8eb3b/actionpack/lib/action_controller/metal/strong_parameters.rb#L550-566
89448a7
@imanel imanel ActiveSupport::HashWithIndifferentAccess select and reject should ret…
…urn enumerator if called without block
800d5ae
@sgrif sgrif Merge pull request #20125
Manually merged to fix conflicts.
4129196
@tenderlove tenderlove remove useless conditional
Since we proved that `element` is always of type `Parameter`, we know
that it will always respond to `permit`, so lets remove this conditional
7779e63
@tenderlove tenderlove push is_a checks up the stack
now `hash_filter` doesn't need to know about the `Parameters` class
e956172
@sgrif sgrif Merge pull request #20902 from sikachu/silence-association-reload-war…
…ning

Silence deprecation warning from force reload
d3ec5c9
@tenderlove tenderlove push fields_for_style? in to a protected method
this way we don't need to call `to_unsafe_h` to get access to ask
questions about the underlying hash
0fedae6
Commits on Jul 18, 2015
@andrii andrii [ci skip] Fix typo in #any? RDoc a8e11ff
@sikachu sikachu Add deprecation warning for `render :text`
We've started on discouraging the usage of `render :text` in #12374.
This is a follow-up commit to make sure that we print out the
deprecation warning.
6790228
@jeremy jeremy Merge pull request #20917 from sikachu/ps-deprecate-render-text
Add deprecation warning for `render :text`
0db98b3
@sikachu sikachu Stop using deprecated `render :text` in test
This will silence deprecation warnings.

Most of the test can be changed from `render :text` to render `:plain`
or `render :body` right away. However, there are some tests that needed
to be fixed by hand as they actually assert the default Content-Type
returned from `render :body`.
8cb8ce9
@matthewd matthewd Merge pull request #20923 from sikachu/silence-render-text-warning
Stop using deprecated `render :text` in test
e78746f
@rsanheim rsanheim add system! to fail fast in bin/setup d54d435
@y-yagi y-yagi use `plain` option instead of deprecated `text` option
this will silence deprecation warnings
fec638c
@kaspth kaspth Merge pull request #20929 from y-yagi/fix_deprecated_warning
use `plain` option instead of deprecated `text` option
0daf161
@prathamesh-sonpatki prathamesh-sonpatki Replaced render :text with render :plain in AC gem bug report template
 - Followup of #20929.
 [ci skip]
dafe299
@sgrif sgrif Merge pull request #20930 from prathamesh-sonpatki/rm-render-text
 Replaced render :text with render :plain in AC gem bug report template
c7449a2
@sgrif sgrif Ensure that `ActionController::Parameters` can still be passed to AR
Since nested hashes are also instances of
`ActionController::Parameters`, and we're explicitly looking to work
with a hash for nested attributes, this caused breakage in several
points.

This is the minimum viable fix for the issue (and one that I'm not
terribly fond of). I can't think of a better place to handle this at the
moment. I'd prefer to use some sort of solution that doesn't special
case AC::Parameters, but we can't use something like `to_h` or `to_a`
since `Enumerable` adds both.

While I've added a trivial test case for verifying this fix in
isolation, we really need better integration coverage to prevent
regressions like this in the future. We don't actually have a lot of
great places for integration coverage at the moment, so I'm deferring it
for now.

Fixes #20922.
68af636
@sgrif sgrif Merge pull request #20763 from maurogeorge/default_scope_create-doc
Add a note about default_scope and create records [ci skip]
2a0a264
@sgrif sgrif Ensure cyclic associations w/ autosave don't cause duplicate errors
This code is so fucked. Things that cause this bug not to replicate:

- Defining the validation before the association (we end up calling
  `uniq!` on the errors in the autosave validation)
- Adding `accepts_nested_attributes_for` (I have no clue why. The only
  thing it does that should affect this is adds `autosave: true` to the
  inverse reflection, and doing that manually doesn't fix this).

This solution is a hack, and I'm almost certain there's a better way to
go about it, but this shouldn't cause a huge hit on validation times,
and is the simplest way to get it done.

Fixes #20874.
7550f0a
@twalpole twalpole Ensure that 'ActionController::Parameters' can still be passed to AR …
…for collection associations
b5d4dd4
@sgrif sgrif Merge pull request #20932 from twalpole/collection_association_parame…
…ters

Ensure that 'ActionController::Parameters' can still be passed to AR …
3f1c5d3
@kaspth kaspth Make digest cache work in development.
Avoid computing the same fragment digest many times when looping over templates.

The cache is cleared on every request so template changes are still picked up.
40f79da
@kaspth kaspth Remove unused persistent option. 7bd70ba
@TheBlasfem TheBlasfem added examples to DateAndTime::Calculations [ci skip] 2849f69
@repinel repinel Fix exception overwritten for parameters fetch method
When executing an `ActionController::Parameters#fetch` with a block
that raises a `KeyError` the raised `KeyError` will be rescued and
converted to an `ActionController::ParameterMissing` exception,
covering up the original exception.

[Jonas Schubert Erlandsson & Roque Pinel]
780af27
Commits on Jul 19, 2015
@sgrif sgrif Merge pull request #20839 from TheBlasfem/added_examples_dateandtime_…
…calculations

Added examples to DateAndTime::Calculations [ci skip]
a443c5f
@seuros seuros Merge pull request #20924 from andrii/master
[ci skip] Fix typo in #any? RDoc
fac744f
@eliotsykes eliotsykes Fix formatting of force_ssl options documentation [ci skip] 2dcd001
@kaspth kaspth Merge pull request #20931 from eliotsykes/force_ssl-docs-options-form…
…atting

Fix formatting of force_ssl options documentation [ci skip]
ff54b96
@repinel repinel Fix `TimeWithZone#eql?` to handle `TimeWithZone` created from `DateTime`
Before:

```ruby
  twz = DateTime.now.in_time_zone
  twz.eql?(twz.dup) => false
```

Now:

```ruby
  twz = DateTime.now.in_time_zone
  twz.eql?(twz.dup) => true
```

Please notice that this fix the `TimeWithZone` comparison to itself,
not to `DateTime`. Based on #3725, `DateTime` should not be equal to
`TimeWithZone`.
46b5b8e
@kaspth kaspth Merge pull request #20944 from repinel/fix-time-with-zone-eql
Fix `TimeWithZone#eql?` to handle `TimeWithZone` created from `DateTime`
0bd247c
@skanev skanev Fix counter_cache for polymorphic associations
Also removes a false positive test that depends on the fixed bug:

At this time, counter_cache does not work with polymorphic relationships
(which is a bug). The test was added to make sure that no
StaleObjectError is raised when the car is destroyed. No such error is
currently raised because the lock version is not incremented by
appending a wheel to the car.

Furthermore, `assert_difference` succeeds because `car.wheels.count`
does not check the counter cache, but the collection size. The test will
fail if it is replaced with `car.wheels_count || 0`.
0ed096d
@sgrif sgrif Fix the test that was broken by #16445 rather than deleting it
Since the counter cache was properly being updated, the model became
stale. Simply reloading the model before attempting to destroy is
sufficient for this case. I believe this is enough of an edge case to be
a valid change to the tests, even though it represents a potential
breaking change.
8cd1d5a
@sgrif sgrif Merge Pull Request #16445 6765d48
@sgrif sgrif Merge pull request #20936 from repinel/fix-params-fetch-exception-ove…
…rwritten

Fix exception overwritten for parameters fetch method
e19acbb
@schneems schneems Freeze string literals when not mutated.
I wrote a utility that helps find areas where you could optimize your program using a frozen string instead of a string literal, it's called [let_it_go](https://github.com/schneems/let_it_go). After going through the output and adding `.freeze` I was able to eliminate the creation of 1,114 string objects on EVERY request to [codetriage](codetriage.com). How does this impact execution?

To look at memory:

```ruby
require 'get_process_mem'

mem = GetProcessMem.new
GC.start
GC.disable
1_114.times { " " }
before = mem.mb

after = mem.mb
GC.enable
puts "Diff: #{after - before} mb"

```

Creating 1,114 string objects results in `Diff: 0.03125 mb` of RAM allocated on every request. Or 1mb every 32 requests.

To look at raw speed:

```ruby
require 'benchmark/ips'

number_of_objects_reduced = 1_114

Benchmark.ips do |x|
  x.report("freeze")    { number_of_objects_reduced.times { " ".freeze } }
  x.report("no-freeze") { number_of_objects_reduced.times { " " } }
end
```

We get the results

```
Calculating -------------------------------------
              freeze     1.428k i/100ms
           no-freeze   609.000  i/100ms
-------------------------------------------------
              freeze     14.363k (± 8.5%) i/s -     71.400k
           no-freeze      6.084k (± 8.1%) i/s -     30.450k
```

Now we can do some maths:

```ruby
ips = 6_226k # iterations / 1 second
call_time_before = 1.0 / ips # seconds per iteration 

ips = 15_254 # iterations / 1 second
call_time_after = 1.0 / ips # seconds per iteration 

diff = call_time_before - call_time_after

number_of_objects_reduced * diff * 100

# => 0.4530373333993266 miliseconds saved per request
```

So we're shaving off 1 second of execution time for every 220 requests. 

Is this going to be an insane speed boost to any Rails app: nope. Should we merge it: yep. 

p.s. If you know of a method call that doesn't modify a string input such as [String#gsub](https://github.com/schneems/let_it_go/blob/b0e2da69f0cca87ab581022baa43291cdf48638c/lib/let_it_go/core_ext/string.rb#L37) please [give me a pull request to the appropriate file](https://github.com/schneems/let_it_go/blob/b0e2da69f0cca87ab581022baa43291cdf48638c/lib/let_it_go/core_ext/string.rb#L37), or open an issue in LetItGo so we can track and freeze more strings. 

Keep those strings Frozen

![](https://www.dropbox.com/s/z4dj9fdsv213r4v/let-it-go.gif?dl=1)
5bb1d4d
@sgrif sgrif Merge pull request #20946 from schneems/schneems/let-it-go
Freeze string literals when not mutated.
f91439d
@sgrif sgrif Fix tests broken by previous commit 6ffec3c
@matthewd matthewd We need stricter locking before we can unload
Specifically, the "loose upgrades" behaviour that allows us to obtain an
exclusive right to load things while other requests are in progress (but
waiting on the exclusive lock for themselves) prevents us from treating
load & unload interchangeably: new things appearing is fine, but they do
*not* expect previously-present constants to vanish.

We can still use loose upgrades for unloading -- once someone has
decided to unload, they don't really care if someone else gets there
first -- it just needs to be tracked separately.
bd31aec
Commits on Jul 20, 2015
@meinac meinac Add missing method name to exception description 1883f37
@meinac meinac fix doc about ActiveRecord::Transactions::ClassMethods#transaction [c…
…i skip]
cc54f6b
@dhh dhh Merge pull request #20384 from kaspth/per-request-cache
Use digest cache in development.
068865a
@sgrif sgrif Merge pull request #20895 from brian-davis/brian-davis
grammar fix to content_for method documentation in capture_helper.rb [ci skip]
fd9c952
@sgrif sgrif Merge pull request #20950 from vngrs/fix_wrong_doc_about_transaction
fix doc about ActiveRecord::Transactions::ClassMethods#transaction [ci skip]
c4c5577
@sgrif sgrif Merge pull request #20949 from vngrs/missing_method_in_exception
Add missing method name to exception description
9bd6e39
@sgrif sgrif Correctly ignore `mark_for_destruction` without `autosave`
As per the docs, `mark_for_destruction` should do nothing if `autosave`
is not set to true. We normally persist associations on a record no
matter what if the record is a new record, but we were always skipping
records which were `marked_for_destruction?`.

Fixes #20882
c0ef95a
@repinel repinel Fix state being carried over from previous transaction
This clears the transaction record state when the transaction finishes
with a `:committed` status.

Considering the following example where `name` is a required attribute.
Before we had `new_record?` returning `true` for a persisted record:

```ruby
  author = Author.create! name: 'foo'
  author.name = nil
  author.save        # => false
  author.new_record? # => true
```
12b0b26
@sgrif sgrif Merge pull request #20947 c0f79be
@sgrif sgrif Fix minor typo in test name 17b8460
@thedarkone thedarkone Tests for AS::Concurrency::ShareLock. 9c4da24
@thedarkone thedarkone Fix ShareLock issues. b3d78e8
@djpowers djpowers Fix minor typo in testing guide
[ci skip]
0e2cc9b
@sgrif sgrif Merge pull request #20956 from djpowers/patch-1
Fix minor typo in testing guide [ci skip]
a2bb266
@jorihardman jorihardman Ensure that microsecond precision is only used for version of mysql t…
…hat support it. Fixes #19711
e975d7c
@matthewd matthewd Order of execution is only guaranteed if upgrading
If the thread isn't yet holding any form of lock, it has no claim over
what may / may not run while it's blocked.
649d817
Commits on Jul 21, 2015
@thejamespinto thejamespinto titleizing the New Link 1acf0f0
@rafaelfranca rafaelfranca Merge pull request #17109 from thejamespinto/patch-1
titleizing the New Link
94e8b3a
@matthewd matthewd Add some meta-assertions for the custom assertions
I accidentally discovered `assert_threads_not_stuck` couldn't fail, so
the simplest solution was to prove they're all now working in both
directions.
ef4d334
@matthewd matthewd Adjust expectations around purpose/compatibility options 4c54b2a
@matthewd matthewd Handle thread death during lock acquisition
Specifically, clean up if the thread is killed while it's blocked
awaiting the lock... if we get killed on some other arbitrary line, the
result remains quite undefined.
e9020ac
@rafaelfranca rafaelfranca Merge pull request #20751 from repinel/remove-unnecessary-dup
Remove unnecessary `dup` from Mapper `add_route`
8ff777f
@sgrif sgrif Merge pull request #20732 from jorihardman/timestamp_precison2
Ensure that microsecond precision is only used for versions of mysql that support it.
51d333a
@repinel repinel Deprecate and rename the keys for association restrict_dependent_destroy
Previously `has_one` and `has_many` associations were using the
`one` and `many` keys respectively. Both of these keys have special
meaning in I18n (they are considered to be pluralizations) so by
renaming them to `has_one` and `has_many` we make the messages more
explicit and most importantly they don't clash with linguistical
systems that need to validate translation keys (and their
pluralizations).

The `:'restrict_dependent_destroy.one'` key should be replaced with
`:'restrict_dependent_destroy.has_one'`, and
`:'restrict_dependent_destroy.many'` with
`:'restrict_dependent_destroy.has_many'`.

[Roque Pinel & Christopher Dell]
b184398
@rafaelfranca rafaelfranca Merge pull request #20668 from repinel/rename-restrict-dependent-dest…
…roy-i18n-key

Deprecate the keys for association `restrict_dependent_destroy` errors in favor of new key names
36ea89a
@rafaelfranca rafaelfranca Merge pull request #20819 from y-yagi/rails_api_gemfile
remove `web-console` from API app generated Gemfile
9582b3f
@rafaelfranca rafaelfranca Merge pull request #20926 from rsanheim/fail-fast-bin-setup
add system! to fail fast in bin/setup
b260a27
@lxsameer lxsameer Extra caller details added to ActiveRecord::RecordNotFound
ActiveRecord::RecordNotFound modified to store model name, primary_key
and id of the caller model. It allows the catcher of this exception to make
a better decision to what to do with it. For example consider this simple
example:

    class SomeAbstractController < ActionController::Base
      rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404

      private def redirect_to_404(e)
        return redirect_to(posts_url) if e.model == 'Post'
        raise
      end
    end
d763956
@rafaelfranca rafaelfranca Merge pull request #20967 from lxsameer/record_not_found
Extra caller details added to ActiveRecord::RecordNotFound
efd2410
@meinac meinac fix rails tests d2e35e1
@rafaelfranca rafaelfranca Merge pull request #20973 from vngrs/fix_rails_tests
fix rails tests
d333dd5
@meinac meinac Fix misleading errors for has_one through relations 4f1ec3a
@tenderlove tenderlove rearrange logic to use positive branches
only hashes are converted to parameter objects, so lets add a branch for
them.  This also removes a is_a? test for Parameters so we can be
abstracted from the class.
c75153d
@tenderlove tenderlove drop conditionals in conversion logic
there is no reason to `convert_hashes_to_parameters` with an assignemt
flag.  The caller knows whether or not it wants the value assigned.  We
should just change the uncommon case (not writing to the underlying
hash) to just call the conversion method and return that value.
5046d51
Commits on Jul 22, 2015
@tenderlove tenderlove recurse for arrays in `normalize_encode_params`
this just pushes the conditional in to the case / when so we can switch
to method dispatch later
14e8377
@tenderlove tenderlove stop keeping track of keys when "deep munging"
This should have been done along with 8f8ccb9
f620d6c
@tenderlove tenderlove push param encoding in to the utils module
we'll refactor deep munge mostly out of existence shortly
3f29929
@tenderlove tenderlove rm `deep_munge`. You will live on in our hearts (and git history)
Now that we have encoding strategies, we can just walk the params hash
once to encode as HWIA, and remove nils.
52cf1a7
@thedarkone thedarkone Small tweaks to mainly lock-ordering tests.
* only test the upgrade path,
* add test to verify non upgrades can’t preempt,
* add reentrancy assertion.
5d67707
Commits on Jul 23, 2015
@matthewd matthewd Don't apply locking around basic #load / #require
That's outside our remit, and dangerous... if a caller has their own
locking to protect against the natural race danger, we'll deadlock
against it.
10c7f54
@matthewd matthewd Merge pull request #20989 from matthewd/no-lock-basic-require
Don't apply locking around basic #load / #require
d517239
@budnik budnik Fixes documentation typo.
Documentation had extra colon after keyword.
a209652
@robin850 robin850 Merge pull request #20993 from budnik/patch-1
Fixes documentation typo.[ci skip]
0e189cb
@robin850 robin850 Rename the enum_{prefix,suffix} options to _{prefix,suffix}
This makes it more clear that they are reserved keywords and also it
seems less redundant as the line already starts with the call to the
`enum` method.
ad5c1a3
@kaspth kaspth Merge pull request #20999 from robin850/enum-prefix-suffix
Rename the enum_prefix and enum_suffix options to _prefix and _suffix
2028b57
@robin850 robin850 Add the `--api` option for the plugin generator 9a7f011
@robin850 robin850 Skip assets, helpers and views generation for API plugins 67863aa
@robin850 robin850 Make ApplicationController inherit from AC::API for API plugins e3cfd5b
@robin850 robin850 Generate an API dummy application for API plugins ce32c9d
@robin850 robin850 Improvements on the enum documentation [ci skip]
The note regarding the `_prefix` and `_suffix` options is no longer
useful since they were renamed specifically for this purpose.

Also the given example doesn't show what these options enable and in
which case they are really useful (when there are conflicting values
for instance).

Refs #20999.

[Godfrey Chan & Robin Dupret]
cdc32de
@robin850 robin850 Enable the `api_only` option for API plugins' generators
This way, running a generator inside the plugin's directory, files that
are not relevant won't be generated (e.g. views or assets).

This won't interfere with the application's generators configuration.
a120f27
@clayton-shopify clayton-shopify Encode the email address as prescribed in RFC 6068 section 2. 6a38782
@amatsuda amatsuda Remove ivar only when defined
this fixes a failing test case
430b7c8
Commits on Jul 24, 2015
@matthewd matthewd Merge pull request #20928 from matthewd/unload-interlock
We need stricter locking before we can unload
40ce686
@sgrif sgrif Merge pull request #20256 from arunagw/aa-remove-unused-rule-and-task…
…-activerecord

Remove unused rule and task from activerecord
cc214cf
@sgrif sgrif `destroy` shouldn't raise when child associations fail to save
Deep down in the association internals, we're calling `destroy!` rather
than `destroy` when handling things like `dependent` or autosave
association callbacks. Unfortunately, due to the structure of the code
(e.g. it uses callbacks for everything), it's nearly impossible to pass
whether to call `destroy` or `destroy!` down to where we actually need
it.

As such, we have to do some legwork to handle this. Since the callbacks
are what actually raise the exception, we need to rescue it in
`ActiveRecord::Callbacks`, rather than `ActiveRecord::Persistence` where
it matters. (As an aside, if this code wasn't so callback heavy, it
would handling this would likely be as simple as changing `destroy` to
call `destroy!` instead of the other way around).

Since we don't want to lose the exception when `destroy!` is called (in
particular, we don't want the value of the `record` field to change to
the parent class), we have to do some additional legwork to hold onto it
where we can use it.

Again, all of this is ugly and there is definitely a better way to do
this. However, barring a much more significant re-architecting for what
I consider to be a reletively minor improvement, I'm willing to take
this small hit to the flow of this code (begrudgingly).
d937a11
@rafaelfranca rafaelfranca Merge pull request #21007 from clayton-shopify/fix-mailto-encoding
Encode the email address as prescribed in RFC 6068 section 2.
9caf2cb
Commits on Jul 25, 2015
@sgrif sgrif Properly allow uniqueness validations on primary keys.
This is an alternate implementation of #20966.

[Sean Griffin & presskey]
119b918
Commits on Jul 26, 2015
@yahonda yahonda Remove @connection instance variable only when defined 330f749
@meinac meinac Fix params_wrapper doc [ci skip]
This feature also works with `PUT`, `PATCH` and `DELETE` requests.
Also developers can add `:url_encoded_form` and `:multipart_form`
into the `:format` for wrapping url encoded or multipart form data.
edda07b
@kaspth kaspth Merge pull request #21030 from yahonda/mysql2_20969
Remove @connection instance variable only when defined
e90b581
@kaspth kaspth Add wildcard template dependencies. a6509d3
Commits on Jul 27, 2015
@radar radar Ryan Bigg has changed jobs. b95cca9
@chancancode chancancode Merge pull request #21035 from radar/ryan-bigg-has-changed-jobs
Ryan Bigg has changed jobs
b55484a
@aditya-kapoor aditya-kapoor [ci skip] it should be protect_from_forgery b4db53f
@rafaelfranca rafaelfranca Merge pull request #21003 from robin850/api-plugins
Allow generating plugins for API applications
695937c
@arthurnn arthurnn Merge pull request #21040 from aditya-kapoor/fix-typo
[ci skip] it should be protect_from_forgery
0a780b1
@kaspth kaspth Merge pull request #20904 from kaspth/wildcard-template-dependencies
Add wildcard template dependencies.
c5583cd
@rafaelfranca rafaelfranca Merge pull request #21031 from vngrs/fix_params_wrapper_doc
Fix params_wrapper doc [ci skip]
f9a02c4
@rafaelfranca rafaelfranca Merge pull request #20759 from vngrs/fix_wrong_doc
Change wrong usage in documentation about autoload_paths [ci skip]
ab6f0df
@rafaelfranca rafaelfranca Merge pull request #20849 from vngrs/misleading_nested_exceptions
Fix misleading errors for has_one through relations
722b272
@rafaelfranca rafaelfranca Merge pull request #20590 from vngrs/set_default_charset
Document, refactor and create test case for ActionDispatch::Response
32b0db2
Commits on Jul 28, 2015
@robin850 robin850 Add `:nodoc:` for internal testing methods [ci skip] a74fbb2
@yui-knk yui-knk [ci skip] Now Action View is completely separated from Action Pack 818427c
@robin850 robin850 Merge pull request #21047 from yui-knk/fix/guide_about_action_pack
[ci skip] Now Action View is completely separated from Action Pack
8452593
@yui-knk yui-knk [ci skip] Add a link to action_controller_overview.html 2962da6
@senny senny Merge pull request #21048 from yui-knk/fix/guide_about_action_pack2
[ci skip] Add a link to action_controller_overview.html
6f4421e
@robin850 robin850 Tiny documentation edits [ci skip] e18bf1d
@y-yagi y-yagi pass the correct argument to mock on a test of `validates_length_of` 0a20e48
@carlosantoniodasilva carlosantoniodasilva Merge pull request #21049 from y-yagi/fix_i18n_validation_test
pass the correct argument to mock on a test of `validates_length_of`
90e893d
Commits on Jul 29, 2015
@yui-knk yui-knk [ci skip] `field_error_proc` is used in `ActionView::Helpers::ActiveM…
…odelInstanceTag`

so replace `Active Record` with `Active Model`
978cca8
@claudiob claudiob Merge pull request #21054 from yui-knk/fix/doc_field_error_proc
[ci skip] `field_error_proc` is used in `ActionView::Helpers::ActiveM…
45c91e7
@yui-knk yui-knk Make silence a warning inserted by commit #4b3f8ac 6149444
@rafaelfranca rafaelfranca Merge pull request #21056 from yui-knk/fix/deprecation_silence
Make silence a warning inserted by commit #4b3f8ac
ff47e45
Commits on Jul 30, 2015
@schneems schneems Fix reported regression rails/sprockets-rails#265
We can prevent the UglifierCompressor from being instantiated prematurely by setting precompile to an empty array in this test.
4bc2469
@schneems schneems Fix rake/notes_test
Presumably due to rails/sprockets-rails#265 sprockets was trying to load the "scss" gem but it isn't in the gemfile:

```
ApplicationTests::RakeTests::RakeNotesTest#test_register_a_new_extension:
LoadError: cannot load such file -- sass
```

If we use an empty precompile list, it won't try to load sass.
9b18ba7
@schneems schneems Merge pull request #21065 from rails/schneems/fix-assets_test
Fix tests on master
10e994c
@schneems schneems Decrease string allocations on AR#respond_to?
When a symbol is passed in, we call `to_s` on it which allocates a string. The two hardcoded symbols that are used internally are `:to_partial_path` and `:to_model`.

This change buys us 71,136 bytes of memory and 1,777 fewer objects per request.
f80aa59
@schneems schneems Decrease string allocations in apply_inflections
In `apply_inflections` a string is down cased and some whitespace stripped in the front (which allocate strings). This would normally be fine, however `uncountables` is a fairly small array (10 elements out of the box) and this method gets called a TON. Instead we can keep an array of valid regexes for each uncountable so we don't have to allocate new strings.

This change buys us 325,106 bytes of memory and 3,251 fewer objects per request.
1bf50ba
@schneems schneems Decrease string allocations in url_options
The request.script_name is dup-d which allocates an extra string. It is most commonly an empty string "". We can save a ton of string allocations by checking first if the string is empty, if so we can use a frozen empty string instead of duplicating an empty string.

This change buys us 35,714 bytes of memory and 893 fewer objects per request.
83ee043
@schneems schneems Speed up journey extract_parameterized_parts
Micro optimization: `reverse.drop_while` is slower than `reverse_each.drop_while`. This doesn't save any object allocations.

Second, `keys_to_keep` is typically a very small array. The operation `parameterized_parts.keys - keys_to_keep` actually allocates two arrays. It is quicker (I benchmarked) to iterate over each and check inclusion in array manually.

This change buys us 1774 fewer objects per request
9b82588
@schneems schneems Speed up journey missing_keys
Most routes have a `route.path.requirements[key]` of `/[-_.a-zA-Z0-9]+\/[-_.a-zA-Z0-9]+/` yet every time this method is called a new regex is generated on the fly with `/\A#{DEFAULT_INPUT}\Z/`. OBJECT ALLOCATIONS BLERG!

This change uses a special module that implements `===` so it can be used in a case statement to pull out the default input. When this happens, we use a pre-generated regex.

This change buys us 1,643,465 bytes of memory and 7,990 fewer objects per request.
097ec6f
@schneems schneems Decrease route_set allocations
In handle_positional_args `Array#-=` is used which allocates a new array. Instead we can iterate through and delete elements, modifying the array in place.

Also `Array#take` allocates a new array. We can build the same by iterating over the other element.

This change buys us 106,470 bytes of memory and 2,663 fewer objects per request.
0cbec58
@schneems schneems Reduce hash allocations in route_set
When generating a url with `url_for` the hash of arguments passed in, is dup-d and merged a TON. I wish I could clean this up better, and might be able to do it in the future. This change removes one dup, since it's literally right after we just dup-d the hash to pass into this constructor.

This may be a breaking, change but the tests pass...so :shipit: we can revert if it causes problems

This change buys us 205,933 bytes of memory and 887 fewer objects per request.
1a14074
@schneems schneems Decrease string allocation in content_tag_string
When an unknonwn key is passed to the hash in `PRE_CONTENT_STRINGS` it returns nil, when you call "#{nil}" it allocates a new empty string. We can get around this allocation by using a default value `Hash.new { "".freeze }`. We can avoid the `to_sym` call by pre-populating the hash with a symbol key in addition to a string key.

We can freeze some strings when using Array#* to reduce allocations.

Array#join can take frozen strings.

This change buys us 86,600 bytes of memory and 1,857 fewer objects per request.
2a4d430
@schneems schneems Optimize hash key
No idea why on earth this hash key isn't already optimized by MRI, but it isn't. :shit:

This change buys us 74,077 bytes of memory and 1,852 fewer objects per request.
2e95d2e
@schneems schneems Cut string ActionView template allocations
The instrument method creates new strings, the most common action to instrument is "!render_template` so we can detect when that action is occurring and use a frozen string instead.

This change buys us 113,714 bytes of memory and 1,790 fewer objects per request.
9b189a3
@schneems schneems Cut string allocations in content_tag_string
content_tag's first argument is will generate a string with an html tag so `:a` will generate: `<a></a>`. When this happens, the symbol is implicitly `to_s`-d so a new string is allocated. We can get around that by using a frozen string instead which

This change buys us 74,236 bytes of memory and 1,855 fewer objects per request.
e76a843
@hedgesky hedgesky Remove yepnope mention from form helpers guide because it's deprecate…
…d [ci skip]
dc4b03f
@kaspth kaspth Merge pull request #21071 from hedgesky/remove_yepnope_mention_from_f…
…orm_helpers_guide

Remove yepnope mention from form helpers guide because it's deprecated
70009e3
@schneems schneems Avoid calling to_s on nil in journey/formatter
When `defaults[key]` in `generate` in the journey formatter is called, it often returns a `nil` when we call `to_s` on a nil, it allocates an empty string. We can skip this check when the default value is nil.

This change buys us 35,431 bytes of memory and 887 fewer objects per request.

Thanks to @matthewd for help with the readability
bff61ba
@schneems schneems Freeze a string in comparator
Saves 888 string objects per request.
045cdd3
@schneems schneems Only allocate new string when needed
Instead of calling `sub` on every link_to call for controller, we can detect when the string __needs__ to be allocated and only then create a new string (without the leading slash), otherwise, use the string that is given to us.

Saves 888 string objects per request, 35,524 bytes.
3fb9e80
@schneems schneems Avoid hash duplication by skipping mutation
If we don't mutate the `recall` hash, then there's no reason to duplicate it. While this change doesn't get rid of that many objects, each hash object it gets rid of was massive.

Saves 888 string objects per request, 206,013 bytes (thats 0.2 mb which is kinda a lot).
1993e2c
@schneems schneems Decrease allocations in transliterate
We can save a few objects by freezing the `replacement` string. We save a few more by down-casing the string in memory instead of allocating a new one. We save far more objects by checking for the default separator `"-"`, and using pre-generated regular expressions.

We will save 209,231 bytes and 1,322 objects.
57ba9cb
@schneems schneems String#freeze optimizations 0d7a714
@schneems schneems Don't allocate array when not necessary
In the `tag_options` method an array is used to build up elements, then `Array#*` (which is an alias for `Array#join` is called to turn the array into a string. Instead of allocating an array to build a string, we can build the string we want from the beginning.

Saved: 121,743 bytes 893 objects
1f831fe
@schneems schneems zOMG 37 objects saved 005541b
@schneems schneems Remove array allocation
THe only reason we were allocating an array is to get the "missing_keys" variable in scope of the error message generator. Guess what? Arrays kinda take up a lot of memory, so by replacing that with a nil, we save:

35,303 bytes and 886 objects per request
4d2ccc1
@schneems schneems Remove (another) array allocation
We don't always need an array when generating a url with the formatter. We can be lazy about allocating the `missing_keys` array. This saves us:

35,606 bytes and 889 objects per request
61dae88
@schneems schneems Use delete_if instead of each; delete(key)
It is slightly faster:

```
Calculating -------------------------------------
        each; delete    35.166k i/100ms
           delete_if    36.416k i/100ms
-------------------------------------------------
        each; delete    478.026k (± 8.5%) i/s -      2.391M
           delete_if    485.123k (± 7.9%) i/s -      2.440M
```
22f5924
@schneems schneems Merge pull request #21057 from schneems/schneems/journey-formatter-ob…
…jects

Beyond Ludicrous Speed
5373bf2
@byroot byroot Array#any? is slower and not the inverse of Array#empty?
```
empty_array = []
small_array = [1] * 30
bigger_array = [1] * 300

Benchmark.ips do |x|
  x.report('empty !empty?') { !empty_array.empty? }
  x.report('small !empty?') { !small_array.empty? }
  x.report('bigger !empty?') { !bigger_array.empty? }

  x.report('empty any?') { empty_array.any? }
  x.report('small any?') { small_array.any? }
  x.report('bigger any?') { bigger_array.any? }
end
```

```
Calculating -------------------------------------
       empty !empty?   132.059k i/100ms
       small !empty?   133.974k i/100ms
      bigger !empty?   133.848k i/100ms
          empty any?   106.924k i/100ms
          small any?    85.525k i/100ms
         bigger any?    86.663k i/100ms
-------------------------------------------------
       empty !empty?      8.522M (± 7.9%) i/s -     42.391M
       small !empty?      8.501M (± 8.5%) i/s -     42.202M
      bigger !empty?      8.434M (± 8.6%) i/s -     41.894M
          empty any?      4.161M (± 8.3%) i/s -     20.743M
          small any?      2.654M (± 5.2%) i/s -     13.256M
         bigger any?      2.642M (± 6.4%) i/s -     13.173M
```

Ref: #21057 (comment)
32133db
@rafaelfranca rafaelfranca Merge pull request #21075 from byroot/not-empty-vs-any
Array#any? is slower and not the inverse of Array#empty?
f8e81d4