mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Merge pull request #995 from airblade/drop_rails_4.0
Drop support for rails 4.0 and 4.1
This commit is contained in:
commit
ac96b70dbe
9 changed files with 14 additions and 49 deletions
|
@ -24,7 +24,6 @@ before_script:
|
|||
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_foo;' -U postgres; fi"
|
||||
|
||||
gemfile:
|
||||
- gemfiles/ar_4.0.gemfile
|
||||
- gemfiles/ar_4.2.gemfile
|
||||
- gemfiles/ar_5.0.gemfile
|
||||
- gemfiles/ar_5.1.gemfile
|
||||
|
|
10
Appraisals
10
Appraisals
|
@ -7,20 +7,16 @@
|
|||
# > the version from the appraisal takes precedence.
|
||||
# > https://github.com/thoughtbot/appraisal
|
||||
|
||||
appraise "ar-4.0" do
|
||||
gem "activerecord", "~> 4.0"
|
||||
end
|
||||
|
||||
appraise "ar-4.2" do
|
||||
gem "activerecord", "~> 4.2"
|
||||
gem "activerecord", "~> 4.2.9"
|
||||
end
|
||||
|
||||
appraise "ar-5.0" do
|
||||
gem "activerecord", "~> 5.0.3"
|
||||
gem "activerecord", "~> 5.0.6"
|
||||
gem "rails-controller-testing"
|
||||
end
|
||||
|
||||
appraise "ar-5.1" do
|
||||
gem "rails", "5.1.1"
|
||||
gem "activerecord", "~> 5.1.4"
|
||||
gem "rails-controller-testing"
|
||||
end
|
||||
|
|
|
@ -7,7 +7,9 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
|||
|
||||
### Breaking Changes
|
||||
|
||||
- Drop support for ruby 2.1, whose EoL was 2017-04-01
|
||||
- Drop support for rails 4.0 and 4.1, whose EoL was
|
||||
[2016-06-30](http://weblog.rubyonrails.org/2016/6/30/Rails-5-0-final/)
|
||||
- Drop support for ruby 2.1, whose EoL was [2017-04-01](http://bit.ly/2ppWDYa)
|
||||
- [#803](https://github.com/airblade/paper_trail/issues/803) -
|
||||
where_object_changes no longer supports reading json from a text column
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# This file was generated by Appraisal
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "activerecord", "~> 4.0"
|
||||
|
||||
gemspec path: "../"
|
|
@ -1,9 +0,0 @@
|
|||
# This file was generated by Appraisal
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "rails", github: "rails/rails"
|
||||
gem "rspec-rails", "~> 3.5.1"
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gemspec path: "../"
|
|
@ -1,10 +1,7 @@
|
|||
module PaperTrail
|
||||
# Represents the "paper trail" for a single record.
|
||||
class RecordTrail
|
||||
# The respond_to? check here is specific to ActiveRecord 4.0 and can be
|
||||
# removed when support for ActiveRecord < 4.2 is dropped.
|
||||
RAILS_GTE_5_1 = ::ActiveRecord.respond_to?(:gem_version) &&
|
||||
::ActiveRecord.gem_version >= ::Gem::Version.new("5.1.0.beta1")
|
||||
RAILS_GTE_5_1 = ::ActiveRecord.gem_version >= ::Gem::Version.new("5.1.0.beta1")
|
||||
|
||||
def initialize(record)
|
||||
@record = record
|
||||
|
@ -477,9 +474,7 @@ module PaperTrail
|
|||
if @in_after_callback && RAILS_GTE_5_1
|
||||
@record.attribute_before_last_save(attr_name.to_s)
|
||||
else
|
||||
# TODO: after dropping support for rails 4.0, remove send, because
|
||||
# attribute_was is no longer private.
|
||||
@record.send(:attribute_was, attr_name.to_s)
|
||||
@record.attribute_was(attr_name.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,10 +12,7 @@ module PaperTrail
|
|||
extend ::ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
# The respond_to? check here is specific to ActiveRecord 4.0 and can be
|
||||
# removed when support for ActiveRecord < 4.2 is dropped.
|
||||
if ::ActiveRecord.respond_to?(:gem_version) &&
|
||||
::ActiveRecord.gem_version >= Gem::Version.new("5.0")
|
||||
if ::ActiveRecord.gem_version >= Gem::Version.new("5.0")
|
||||
belongs_to :item, polymorphic: true, optional: true
|
||||
else
|
||||
belongs_to :item, polymorphic: true
|
||||
|
|
|
@ -26,7 +26,7 @@ has been destroyed.
|
|||
s.required_ruby_version = ">= 2.2.0"
|
||||
|
||||
# Rails does not follow semver, makes breaking changes in minor versions.
|
||||
s.add_dependency "activerecord", [">= 4.0", "< 5.2"]
|
||||
s.add_dependency "activerecord", [">= 4.2", "< 5.2"]
|
||||
s.add_dependency "request_store", "~> 1.1"
|
||||
|
||||
s.add_development_dependency "appraisal", "~> 2.1"
|
||||
|
@ -34,7 +34,7 @@ has been destroyed.
|
|||
s.add_development_dependency "ffaker", "~> 2.5"
|
||||
|
||||
# Why `railties`? Possibly used by `spec/dummy_app` boot up?
|
||||
s.add_development_dependency "railties", [">= 4.0", "< 5.2"]
|
||||
s.add_development_dependency "railties", [">= 4.2", "< 5.2"]
|
||||
|
||||
s.add_development_dependency "rack-test", "~> 0.6.3"
|
||||
s.add_development_dependency "rspec-rails", "~> 3.5"
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
require "rubygems"
|
||||
|
||||
# We normally use the root project Gemfile (and gemspec), but when we run rake
|
||||
# locally (not on travis) in this dummy app, we set the BUNDLE_GEMFILE env.
|
||||
# variable. The project Gemfile/gemspec allows AR 4.0, which is a problem
|
||||
# because this dummy app uses `enum` in some of its models, and `enum` was
|
||||
# introduced in AR 4.1. So, when we run rake here, we use:
|
||||
#
|
||||
# BUNDLE_GEMFILE=../../gemfiles/ar_4.2.gemfile bundle exec rake
|
||||
#
|
||||
# Once we drop support for AR 4.0 and 4.1 this will be less of a problem, but
|
||||
# we should keep the ability to specify BUNDLE_GEMFILE because the same
|
||||
# situation could come up in the future.
|
||||
# When you run rake locally (not on travis) in this dummy app, set the
|
||||
# BUNDLE_GEMFILE env. variable to ensure that the correct version of AR is used
|
||||
# for e.g. migrations. See examples in CONTRIBUTING.md.
|
||||
unless ENV.key?("BUNDLE_GEMFILE")
|
||||
gemfile = File.expand_path("../../../../Gemfile", __FILE__)
|
||||
if File.exist?(gemfile)
|
||||
|
|
Loading…
Reference in a new issue