Merge pull request #1133 from paper-trail-gem/various_2018-08-14

Various 2018-08-14
This commit is contained in:
Jared Beck 2018-08-14 03:10:19 -04:00 committed by GitHub
commit 6c34a3dd5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 56 deletions

View File

@ -95,6 +95,16 @@ Naming/PredicateName:
Naming/UncommunicativeMethodParamName: Naming/UncommunicativeMethodParamName:
Enabled: false Enabled: false
# This cop does not work correctly in rubocop-rspec 1.27.0
RSpec/EmptyLineAfterExampleGroup:
Enabled: false
# Yes, ideally examples would be short. Is it possible to pick a limit and say,
# "no example will ever be longer than this"? Hard to say. Sometimes they're
# quite long.
RSpec/ExampleLength:
Enabled: false
RSpec/FilePath: RSpec/FilePath:
Exclude: Exclude:
- spec/paper_trail/association_reify_error_behaviour/error.rb - spec/paper_trail/association_reify_error_behaviour/error.rb
@ -108,12 +118,6 @@ RSpec/FilePath:
RSpec/MultipleExpectations: RSpec/MultipleExpectations:
Enabled: false Enabled: false
# Yes, ideally examples would be short. Is it possible to pick a limit and say,
# "no example will ever be longer than this"? Hard to say. Sometimes they're
# quite long.
RSpec/ExampleLength:
Enabled: false
# Please use semantic style, e.g. `do` when there's a side-effect, else `{}`. # Please use semantic style, e.g. `do` when there's a side-effect, else `{}`.
# The semantic style is too nuanced to lint, so the cop is disabled. # The semantic style is too nuanced to lint, so the cop is disabled.
Style/BlockDelimiters: Style/BlockDelimiters:

View File

@ -16,18 +16,10 @@ end
appraise "ar-5.1" do appraise "ar-5.1" do
gem "activerecord", "~> 5.1.5" gem "activerecord", "~> 5.1.5"
gem "rails-controller-testing" gem "rails-controller-testing", "~> 1.0.2"
end end
appraise "ar-5.2" do appraise "ar-5.2" do
gem "activerecord", "~> 5.2.0.rc2" gem "activerecord", "~> 5.2.1"
gem "rails-controller-testing" gem "rails-controller-testing", "~> 1.0.2"
# bundler does not handle rc versions well
# https://github.com/paper-trail-gem/paper_trail/pull/1067
# so we specify activesupport, actionpack, and railties, which we
# would not normally do, as you can see with other rails versions above.
gem "activesupport", "~> 5.2.0.rc2"
gem "actionpack", "~> 5.2.0.rc2"
gem "railties", "~> 5.2.0.rc2"
end end

View File

@ -3,11 +3,23 @@
This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the
recommendations of [keepachangelog.com](http://keepachangelog.com/). recommendations of [keepachangelog.com](http://keepachangelog.com/).
## Unreleased ## 10.0.0 (Unreleased)
### Breaking Changes PT 10 tackles some tough issues that required breaking changes. We fixed a
long-standing issue with STI, and saved major disk space in databases with tens
of millions of version records. Special thanks to @lorint and @seanlinsley,
respectively.
- Remove all methods deprecated in PT 9 ### Breaking changes affecting most people
- [#1132](https://github.com/paper-trail-gem/paper_trail/pull/1132) - Removed a
dozen methods deprecated in PT 9. Make sure you've addressed all deprecation
warnings before upgrading.
### Breaking changes affecting fewer people
- `paper_trail-association_tracking` is no longer a runtime dependency. If you
use it (`track_associations = true`) you must now add it to your own `Gemfile`.
- [#1108](https://github.com/paper-trail-gem/paper_trail/pull/1108) - - [#1108](https://github.com/paper-trail-gem/paper_trail/pull/1108) -
In `versions.item_type`, we now store the subclass name instead of In `versions.item_type`, we now store the subclass name instead of
the base_class. the base_class.
@ -16,28 +28,32 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
creates a migration that updates existing `version` entries such that creates a migration that updates existing `version` entries such that
`item_type` then refers to the specific class name instead of base_class. `item_type` then refers to the specific class name instead of base_class.
See [5.c. Generators][2] for instructions. See [5.c. Generators][2] for instructions.
- This change fixes a long-standing issue with reification of STI subclasses, - [#1130](https://github.com/paper-trail-gem/paper_trail/pull/1130) -
[#594](https://github.com/paper-trail-gem/paper_trail/issues/594) Removed `save_changes`. For those wanting to save space, it's more effective
- Removed `touch_with_version`, was deprecated in 9.0.0 to drop the `object` column. If you need ultimate control over the
`object_changes` column, you can write your own `object_changes_adapter`.
### Breaking changes most people won't care about
- [#1121](https://github.com/paper-trail-gem/paper_trail/issues/1121) - - [#1121](https://github.com/paper-trail-gem/paper_trail/issues/1121) -
`touch` now always inserts `null` in `object_changes`. `touch` now always inserts `null` in `object_changes`.
- [#1099](https://github.com/paper-trail-gem/paper_trail/issues/1099) - - [#1123](https://github.com/paper-trail-gem/paper_trail/pull/1123) -
Removed `save_changes`. For those wanting to save space, it's more effective `object_changes` is now populated on destroy in order to make
to drop the `object` column. To preserve the old behavior you can add an `where_object_changes` usable when you've dropped the `object` column.
`object_changes_adapter`. Sean is working on an optional backport migration and will post about it in
[#1099](https://github.com/paper-trail-gem/paper_trail/issues/1099) when
he's done.
### Added ### Added
- [#1099](https://github.com/paper-trail-gem/paper_trail/issues/1099) - - [#1099](https://github.com/paper-trail-gem/paper_trail/issues/1099) -
Ability to save ~50% storage space by making the `object` column optional. Ability to save ~50% storage space by making the `object` column optional.
Note that this disables `reify` and `where_object`. Note that this disables `reify` and `where_object`.
- `object_changes` is now populated on destroy in order to make
`where_object_changes` usable when you've dropped the `object` column.
See the issue for a backport migration.
### Fixed ### Fixed
- None - [#594](https://github.com/paper-trail-gem/paper_trail/issues/594) -
A long-standing issue with reification of STI subclasses
## 9.2.0 (2018-06-09) ## 9.2.0 (2018-06-09)

View File

@ -844,10 +844,11 @@ these issues, PT-AT was extracted (see
https://github.com/paper-trail-gem/paper_trail/issues/1070). https://github.com/paper-trail-gem/paper_trail/issues/1070).
Even though this has always been an experimental feature, we don't want the Even though this has always been an experimental feature, we don't want the
extraction of PT-AT to be a breaking change. So, `paper_trail` will have a extraction of PT-AT to be a breaking change. In PT 9, PT-AT was kept as a
runtime dependency on this gem and will keep running the existing tests related runtime dependency. In PT 10, it is a development dependency, so if you use it
to association tracking. This arrangement will be maintained for a few years, if you must add it to your own `Gemfile`. We will keep PT-AT as a development
practical. dependency and continue running the existing tests related to association
tracking for as long as is practical.
### 4.c. Storing Metadata ### 4.c. Storing Metadata

View File

@ -3,6 +3,6 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "activerecord", "~> 5.1.5" gem "activerecord", "~> 5.1.5"
gem "rails-controller-testing" gem "rails-controller-testing", "~> 1.0.2"
gemspec path: "../" gemspec path: "../"

View File

@ -2,10 +2,7 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "activerecord", "~> 5.2.0.rc2" gem "activerecord", "~> 5.2.1"
gem "rails-controller-testing" gem "rails-controller-testing", "~> 1.0.2"
gem "activesupport", "~> 5.2.0.rc2"
gem "actionpack", "~> 5.2.0.rc2"
gem "railties", "~> 5.2.0.rc2"
gemspec path: "../" gemspec path: "../"

View File

@ -29,15 +29,6 @@ has been destroyed.
# Rails does not follow semver, makes breaking changes in minor versions. # Rails does not follow semver, makes breaking changes in minor versions.
s.add_dependency "activerecord", [">= 4.2", "< 5.3"] s.add_dependency "activerecord", [">= 4.2", "< 5.3"]
# This `PT_ASSOCIATION_TRACKING` variable is convenient for the test suite of
# `paper_trail-association_tracking`. Normal users of paper_trail should not
# set this variable. This variable may be removed in the future without
# warning.
unless ENV["PT_ASSOCIATION_TRACKING"] == "false"
s.add_dependency "paper_trail-association_tracking", "< 2"
end
s.add_dependency "request_store", "~> 1.1" s.add_dependency "request_store", "~> 1.1"
s.add_development_dependency "appraisal", "~> 2.2" s.add_development_dependency "appraisal", "~> 2.2"
@ -45,10 +36,11 @@ has been destroyed.
s.add_development_dependency "ffaker", "~> 2.8" s.add_development_dependency "ffaker", "~> 2.8"
s.add_development_dependency "generator_spec", "~> 0.9.4" s.add_development_dependency "generator_spec", "~> 0.9.4"
s.add_development_dependency "mysql2", "~> 0.4.10" s.add_development_dependency "mysql2", "~> 0.4.10"
s.add_development_dependency "paper_trail-association_tracking", "< 2"
s.add_development_dependency "pg", "~> 0.21.0" s.add_development_dependency "pg", "~> 0.21.0"
s.add_development_dependency "rake", "~> 12.3" s.add_development_dependency "rake", "~> 12.3"
s.add_development_dependency "rspec-rails", "~> 3.7.2" s.add_development_dependency "rspec-rails", "~> 3.7.2"
s.add_development_dependency "rubocop", "~> 0.56.0" s.add_development_dependency "rubocop", "~> 0.58.2"
s.add_development_dependency "rubocop-rspec", "~> 1.25.1" s.add_development_dependency "rubocop-rspec", "~> 1.27.0"
s.add_development_dependency "sqlite3", "~> 1.3" s.add_development_dependency "sqlite3", "~> 1.3"
end end

View File

@ -4,6 +4,7 @@ require "spec_helper"
RSpec.describe WidgetsController, type: :controller, versioning: true do RSpec.describe WidgetsController, type: :controller, versioning: true do
before { request.env["REMOTE_ADDR"] = "127.0.0.1" } before { request.env["REMOTE_ADDR"] = "127.0.0.1" }
after { RequestStore.store[:paper_trail] = nil } after { RequestStore.store[:paper_trail] = nil }
describe "#create" do describe "#create" do

View File

@ -1,6 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
::ActiveSupport::Deprecation.silence do ::PaperTrail.config.track_associations = true
::PaperTrail.config.track_associations = true ::PaperTrail.config.i_have_updated_my_existing_item_types = true
::PaperTrail.config.i_have_updated_my_existing_item_types = true
end

View File

@ -33,6 +33,7 @@ RSpec.describe Boolit, type: :model, versioning: true do
boolit.update_attributes!(name: nil) boolit.update_attributes!(name: nil)
boolit.update_attributes!(name: FFaker::Name.name) boolit.update_attributes!(name: FFaker::Name.name)
end end
after { PaperTrail.serializer = PaperTrail::Serializers::YAML } after { PaperTrail.serializer = PaperTrail::Serializers::YAML }
it "does not overwrite that attribute during the reification process" do it "does not overwrite that attribute during the reification process" do