From dc4fc621ef3da5beacca39b0d5f42be18180f39e Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Fri, 3 Mar 2017 11:54:48 -0500 Subject: [PATCH 1/2] Remove deprecated methods re: serialized attributes These methods were deprecated in PT 5.0.0 https://github.com/airblade/paper_trail/pull/679 --- CHANGELOG.md | 4 ++++ lib/paper_trail.rb | 8 -------- lib/paper_trail/config.rb | 15 --------------- lib/paper_trail/model_config.rb | 4 ++++ 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 350a9196..8641abe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/). - Drop support for ruby 1.9.3, whose EOL was 2015-02-23 - Drop support for ruby 2.0.0, whose EOL was 2016-02-24 +- Remove deprecated config methods: + - PaperTrail.serialized_attributes? + - PaperTrail.config.serialized_attributes + - PaperTrail.config.serialized_attributes= ### Added diff --git a/lib/paper_trail.rb b/lib/paper_trail.rb index e405a3eb..8d75e172 100644 --- a/lib/paper_trail.rb +++ b/lib/paper_trail.rb @@ -34,14 +34,6 @@ module PaperTrail !!PaperTrail.config.enabled end - def serialized_attributes? - ActiveSupport::Deprecation.warn( - "PaperTrail.serialized_attributes? is deprecated without replacement " + - "and always returns false." - ) - false - end - # Sets whether PaperTrail is enabled or disabled for the current request. # @api public def enabled_for_controller=(value) diff --git a/lib/paper_trail/config.rb b/lib/paper_trail/config.rb index caf6b023..f4d95814 100644 --- a/lib/paper_trail/config.rb +++ b/lib/paper_trail/config.rb @@ -18,21 +18,6 @@ module PaperTrail @serializer = PaperTrail::Serializers::YAML end - def serialized_attributes - ActiveSupport::Deprecation.warn( - "PaperTrail.config.serialized_attributes is deprecated without " + - "replacement and always returns false." - ) - false - end - - def serialized_attributes=(_) - ActiveSupport::Deprecation.warn( - "PaperTrail.config.serialized_attributes= is deprecated without " + - "replacement and no longer has any effect." - ) - end - # Previously, we checked `PaperTrail::VersionAssociation.table_exists?` # here, but that proved to be problematic in situations when the database # connection had not been established, or when the database does not exist diff --git a/lib/paper_trail/model_config.rb b/lib/paper_trail/model_config.rb index 61edc973..d4ef0fb6 100644 --- a/lib/paper_trail/model_config.rb +++ b/lib/paper_trail/model_config.rb @@ -80,6 +80,10 @@ module PaperTrail options[:on] = Array(options[:on]) # Support single symbol @model_class.send :include, ::PaperTrail::Model::InstanceMethods if ::ActiveRecord::VERSION::STRING < "4.2" + ::ActiveSupport::Deprecation.warn( + "Your version of ActiveRecord (< 4.2) has reached EOL. PaperTrail " \ + "will soon drop support. Please upgrade ActiveRecord ASAP." + ) @model_class.send :extend, AttributeSerializers::LegacyActiveRecordShim end setup_options(options) From 75c1e88a8723876b8bc7e1f8df6b5bf5af435f5b Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Fri, 3 Mar 2017 12:03:56 -0500 Subject: [PATCH 2/2] Fix sqlite error in test schema ``` ActiveRecord::StatementInvalid: SQLite3::SQLException: object name reserved for internal use: sqlite_autoindex_custom_primary_key_records_1: CREATE UNIQUE INDEX "sqlite_autoindex_custom_primary_key_records_1" ON "custom_primary_key_records" ("uuid") ``` --- test/dummy/db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 0d16461f..521939ba 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -91,7 +91,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.index ["uuid"], name: "sqlite_autoindex_custom_primary_key_records_1", unique: true + t.index ["uuid"], unique: true end create_table "customers", force: :cascade do |t|