It prevents the repeating hashes creation during the calculation of `object` and `object_changes`.
The real-life case, discovered with a help of `memory_profiler` gem:
1. It saves `~35Mb` per bulk of 100 typical objects like `User`;
2. It saves `~875Mb` per Sidekiq process full of bulk jobs like P1,
under default concurrency 25.
* Change update_attributes to update
In Rails 6.0 update_attributes/update_attributes! is considered deprecated. Method update/update! is the replacement.
* CI: Don't use Bundler 1.16.1
- Bundler 1.16.1 has bug where dependencies can't be resolved properly
when a gem is a release candidate or an alpha version.
The underlying bundler issue can be found here https://github.com/bundler/bundler/issues/6449
* Disable eager_load in test env:
- In Rails 6.0, rails/rails@3b95478 made a change to eagerly define
attribute methods of a Model when `eager_load` is enabled.
This breaks our test suite because of the way we run migration.
The TL;DR is that doing `People.attribute_names` will return an
empty array instead of `[:id, time_zone, ...]`.
You can find a failing build here https://travis-ci.org/paper-trail-gem/paper_trail/jobs/463369634
Basically what happens is:
1) The dummy app boot, attribute methods of each model are defined
but since migration didn't run yet, the tables aren't even
created resulting in a empty attribute set.
2) Migration runs, but it's already too late.
In this commit I disabled eager_loading in test, AFAIT there isn't
much benefit in eager_loading the dummy app anyway.
Also renaming the `user.rb` file to `postgres_user.rb` in order for
rails autoloading to work correctly.
Sean's approach to dropping/re-adding the column during the test run
worked, but it had a few disadvantages:
1. it required a `before(:all)` callback, which is frowned upon by rubocop-rspec
2. more importantly, it could have prevented us from using test parallelization
in the future
3. least importantly, it produced annoying output in the middle of the test run
* integrate versioning into AR touch method
* add touch to list of :on events, deprecate touch_with_version
* integrate versioning into AR touch method
- Fix Lint/RescueWithoutErrorClass
- And I use the term "fix" loosely
- Fix RSpec/PredicateMatcher
- The failure message should actually be better this way too.
- RSpec/LetBeforeExamples
- RSpec/HookArgument
- Fix RSpec/ExpectInHook in widget_spec.rb
- Fix RSpec/MessageSpies
- I like spies. I've never linted them before, but I like how they
separate test setup from assertions.
model_spec is far too long, let's break it up into specs for individual
models in the dummy app.
Extract spec/models/legacy_widget_spec.rb
Extract spec/models/on/empty_array_spec.rb
Extract spec/models/on/create_spec.rb
Extract spec/models/on/update_spec.rb
Extract spec/models/on/destroy_spec.rb
Move an example to config_spec.rb
Extract spec/models/translation_spec.rb
Extract spec/models/article_spec.rb
Move examples to document_spec.rb
The reason some projects have both is so that some spec files can be
run in isolation, without the rails stuff. In practice, I don't find
myself ever doing this. So, the complexity of two files is unnecessary.