Skip to content

Commit

Permalink
Merge pull request #902 from airblade/prepare_release_6
Browse files Browse the repository at this point in the history
Prepare release 6.0.0
  • Loading branch information
jaredbeck committed Dec 4, 2016
2 parents 53f5665 + 6e7acc1 commit 05dd9fb
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 41 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,7 +3,21 @@
This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the
recommendations of [keepachangelog.com](http://keepachangelog.com/).

## 6.0.0 (Unreleased)
## Unreleased

### Breaking Changes

- None

### Added

- None

### Fixed

- None

## 6.0.0 (2016-12-03)

Now with rails 5.1 support, and less model pollution! About 40 methods that were
polluting your models' namespaces have been removed, reducing the chances of a
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -10,7 +10,7 @@ has been destroyed.

| Version | Documentation |
| -------------- | ------------- |
| Unreleased | https://github.com/airblade/paper_trail/blob/master/README.md |
| 6.0.0 | https://github.com/airblade/paper_trail/blob/master/README.md |
| 5.2.3 | https://github.com/airblade/paper_trail/blob/v5.2.3/README.md |
| 4.2.0 | https://github.com/airblade/paper_trail/blob/v4.2.0/README.md |
| 3.0.9 | https://github.com/airblade/paper_trail/blob/v3.0.9/README.md |
Expand Down Expand Up @@ -62,7 +62,7 @@ has been destroyed.

| paper_trail | branch | tags | ruby | activerecord |
| -------------- | ---------- | ------ | -------- | ------------- |
| 6 (unreleased) | master | | >= 1.9.3 | >= 4.0, < 6 |
| 6 | master | v6.x | >= 1.9.3 | >= 4.0, < 6 |
| 5 | 5-stable | v5.x | >= 1.9.3 | >= 3.0, < 5.1 |
| 4 | 4-stable | v4.x | >= 1.8.7 | >= 3.0, < 5.1 |
| 3 | 3.0-stable | v3.x | >= 1.8.7 | >= 3.0, < 5 |
Expand Down
68 changes: 36 additions & 32 deletions lib/paper_trail/record_trail.rb
Expand Up @@ -456,6 +456,42 @@ def add_transaction_id_to(data)
data[:transaction_id] = PaperTrail.transaction_id
end

# @api private
def attribute_changed_in_latest_version?(attr_name)
if @in_after_callback && RAILS_GTE_5_1
@record.saved_change_to_attribute?(attr_name.to_s)
else
@record.attribute_changed?(attr_name.to_s)
end
end

# @api private
def attribute_in_previous_version(attr_name)
if @in_after_callback && RAILS_GTE_5_1
@record.attribute_before_last_save(attr_name.to_s)
else
@record.attribute_was(attr_name.to_s)
end
end

# @api private
def changed_in_latest_version
if @in_after_callback && RAILS_GTE_5_1
@record.saved_changes.keys
else
@record.changed
end
end

# @api private
def changes_in_latest_version
if @in_after_callback && RAILS_GTE_5_1
@record.saved_changes
else
@record.changes
end
end

# Given a HABTM association, returns an array of ids.
# @api private
def habtm_assoc_ids(habtm_assoc)
Expand Down Expand Up @@ -502,37 +538,5 @@ def version
def versions
@record.public_send(@record.class.versions_association_name)
end

def attribute_in_previous_version(attr_name)
if @in_after_callback && RAILS_GTE_5_1
@record.attribute_before_last_save(attr_name.to_s)
else
@record.attribute_was(attr_name.to_s)
end
end

def changed_in_latest_version
if @in_after_callback && RAILS_GTE_5_1
@record.saved_changes.keys
else
@record.changed
end
end

def changes_in_latest_version
if @in_after_callback && RAILS_GTE_5_1
@record.saved_changes
else
@record.changes
end
end

def attribute_changed_in_latest_version?(attr_name)
if @in_after_callback && RAILS_GTE_5_1
@record.saved_change_to_attribute?(attr_name.to_s)
else
@record.attribute_changed?(attr_name.to_s)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/paper_trail/version_number.rb
Expand Up @@ -4,7 +4,7 @@ module VERSION
MAJOR = 6
MINOR = 0
TINY = 0
PRE = "pre".freeze
PRE = nil

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze

Expand Down
7 changes: 2 additions & 5 deletions paper_trail.gemspec
Expand Up @@ -20,11 +20,8 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.required_ruby_version = ">= 1.9.3"

# Rails 5.1 will deprecate the current behavior of AR::Dirty
# (https://github.com/rails/rails/pull/25337) which is pretty important
# to PT. I haven't found good instructions yet on how to upgrade, but
# Sean Griffin described it as easy, on his podcast (http://bikeshed.fm/87).
s.add_dependency "activerecord", [">= 4.0", "< 5.1"]
# Rails does not follow semver, makes breaking changes in minor versions.
s.add_dependency "activerecord", [">= 4.0", "< 5.2"]
s.add_dependency "request_store", "~> 1.1"

s.add_development_dependency "appraisal", "~> 2.1"
Expand Down

0 comments on commit 05dd9fb

Please sign in to comment.