diff --git a/.rubocop.yml b/.rubocop.yml index 74d8048d..1c59cca5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -95,6 +95,16 @@ Naming/PredicateName: Naming/UncommunicativeMethodParamName: 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: Exclude: - spec/paper_trail/association_reify_error_behaviour/error.rb @@ -108,12 +118,6 @@ RSpec/FilePath: RSpec/MultipleExpectations: 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 `{}`. # The semantic style is too nuanced to lint, so the cop is disabled. Style/BlockDelimiters: diff --git a/Appraisals b/Appraisals index 283d56d6..19596350 100644 --- a/Appraisals +++ b/Appraisals @@ -16,18 +16,10 @@ end appraise "ar-5.1" do gem "activerecord", "~> 5.1.5" - gem "rails-controller-testing" + gem "rails-controller-testing", "~> 1.0.2" end appraise "ar-5.2" do - gem "activerecord", "~> 5.2.0.rc2" - gem "rails-controller-testing" - - # 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" + gem "activerecord", "~> 5.2.1" + gem "rails-controller-testing", "~> 1.0.2" end diff --git a/CHANGELOG.md b/CHANGELOG.md index 7682de0d..43a37995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,23 @@ This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the 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) - In `versions.item_type`, we now store the subclass name instead of the base_class. @@ -16,28 +28,32 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/). creates a migration that updates existing `version` entries such that `item_type` then refers to the specific class name instead of base_class. See [5.c. Generators][2] for instructions. - - This change fixes a long-standing issue with reification of STI subclasses, - [#594](https://github.com/paper-trail-gem/paper_trail/issues/594) -- Removed `touch_with_version`, was deprecated in 9.0.0 +- [#1130](https://github.com/paper-trail-gem/paper_trail/pull/1130) - + Removed `save_changes`. For those wanting to save space, it's more effective + 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) - `touch` now always inserts `null` in `object_changes`. -- [#1099](https://github.com/paper-trail-gem/paper_trail/issues/1099) - - Removed `save_changes`. For those wanting to save space, it's more effective - to drop the `object` column. To preserve the old behavior you can add an - `object_changes_adapter`. +- [#1123](https://github.com/paper-trail-gem/paper_trail/pull/1123) - + `object_changes` is now populated on destroy in order to make + `where_object_changes` usable when you've dropped the `object` column. + 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 - [#1099](https://github.com/paper-trail-gem/paper_trail/issues/1099) - Ability to save ~50% storage space by making the `object` column optional. 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 -- 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) diff --git a/README.md b/README.md index b83435a6..6e91851e 100644 --- a/README.md +++ b/README.md @@ -844,10 +844,11 @@ these issues, PT-AT was extracted (see https://github.com/paper-trail-gem/paper_trail/issues/1070). 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 -runtime dependency on this gem and will keep running the existing tests related -to association tracking. This arrangement will be maintained for a few years, if -practical. +extraction of PT-AT to be a breaking change. In PT 9, PT-AT was kept as a +runtime dependency. In PT 10, it is a development dependency, so if you use it +you must add it to your own `Gemfile`. We will keep PT-AT as a development +dependency and continue running the existing tests related to association +tracking for as long as is practical. ### 4.c. Storing Metadata diff --git a/gemfiles/ar_5.1.gemfile b/gemfiles/ar_5.1.gemfile index 1e996020..6f8e07d1 100644 --- a/gemfiles/ar_5.1.gemfile +++ b/gemfiles/ar_5.1.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 5.1.5" -gem "rails-controller-testing" +gem "rails-controller-testing", "~> 1.0.2" gemspec path: "../" diff --git a/gemfiles/ar_5.2.gemfile b/gemfiles/ar_5.2.gemfile index 2b8f1c2e..cd895511 100644 --- a/gemfiles/ar_5.2.gemfile +++ b/gemfiles/ar_5.2.gemfile @@ -2,10 +2,7 @@ source "https://rubygems.org" -gem "activerecord", "~> 5.2.0.rc2" -gem "rails-controller-testing" -gem "activesupport", "~> 5.2.0.rc2" -gem "actionpack", "~> 5.2.0.rc2" -gem "railties", "~> 5.2.0.rc2" +gem "activerecord", "~> 5.2.1" +gem "rails-controller-testing", "~> 1.0.2" gemspec path: "../" diff --git a/paper_trail.gemspec b/paper_trail.gemspec index 36d464cc..4a19dd45 100644 --- a/paper_trail.gemspec +++ b/paper_trail.gemspec @@ -29,15 +29,6 @@ has been destroyed. # Rails does not follow semver, makes breaking changes in minor versions. 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_development_dependency "appraisal", "~> 2.2" @@ -45,10 +36,11 @@ has been destroyed. s.add_development_dependency "ffaker", "~> 2.8" s.add_development_dependency "generator_spec", "~> 0.9.4" 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 "rake", "~> 12.3" s.add_development_dependency "rspec-rails", "~> 3.7.2" - s.add_development_dependency "rubocop", "~> 0.56.0" - s.add_development_dependency "rubocop-rspec", "~> 1.25.1" + s.add_development_dependency "rubocop", "~> 0.58.2" + s.add_development_dependency "rubocop-rspec", "~> 1.27.0" s.add_development_dependency "sqlite3", "~> 1.3" end diff --git a/spec/controllers/widgets_controller_spec.rb b/spec/controllers/widgets_controller_spec.rb index f58096d6..9768699b 100644 --- a/spec/controllers/widgets_controller_spec.rb +++ b/spec/controllers/widgets_controller_spec.rb @@ -4,6 +4,7 @@ require "spec_helper" RSpec.describe WidgetsController, type: :controller, versioning: true do before { request.env["REMOTE_ADDR"] = "127.0.0.1" } + after { RequestStore.store[:paper_trail] = nil } describe "#create" do diff --git a/spec/dummy_app/config/initializers/paper_trail.rb b/spec/dummy_app/config/initializers/paper_trail.rb index ca907539..274aa269 100644 --- a/spec/dummy_app/config/initializers/paper_trail.rb +++ b/spec/dummy_app/config/initializers/paper_trail.rb @@ -1,6 +1,4 @@ # frozen_string_literal: true -::ActiveSupport::Deprecation.silence do - ::PaperTrail.config.track_associations = true - ::PaperTrail.config.i_have_updated_my_existing_item_types = true -end +::PaperTrail.config.track_associations = true +::PaperTrail.config.i_have_updated_my_existing_item_types = true diff --git a/spec/models/boolit_spec.rb b/spec/models/boolit_spec.rb index 538d9ea6..27e4c0ff 100644 --- a/spec/models/boolit_spec.rb +++ b/spec/models/boolit_spec.rb @@ -33,6 +33,7 @@ RSpec.describe Boolit, type: :model, versioning: true do boolit.update_attributes!(name: nil) boolit.update_attributes!(name: FFaker::Name.name) end + after { PaperTrail.serializer = PaperTrail::Serializers::YAML } it "does not overwrite that attribute during the reification process" do