paper_trail-active_record 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +10 -0
- data/Readme.md +3 -3
- data/bin/console +1 -1
- data/lib/paper_trail/active_record/base_extensions.rb +4 -4
- data/lib/paper_trail/active_record/configuration.rb +1 -1
- data/lib/paper_trail/active_record/or_deleted.rb +1 -1
- data/lib/paper_trail/active_record/version.rb +2 -2
- data/lib/paper_trail/active_record/version_extensions.rb +5 -3
- data/lib/paper_trail/active_record.rb +3 -1
- data/paper_trail-active_record.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 934cfc40b232a8284fdd96e5b6ee941bbcbf743cad7efc46615f1b41e1de7ec4
|
4
|
+
data.tar.gz: 2a9ce631a65f989b558343f340b9fd56b1aed9d9cc421b3f10e2593d52de3d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cce01fc8714b7573a877c02f0c190559b466ce13c35168a9e77ed85d8286f412afb850a3fc1b70283e98295334fb6e2beffb2f4eba1b8d80dfd696bf94ff3898
|
7
|
+
data.tar.gz: 16d19245089055b4697aa1de1046d64de445d555e1490e1468cd5a5d3a9ac03cf667989edf40863d0ecf8a5aa168f0b8c3162709d11f3954970627452aeed8b4
|
data/Changelog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 1.0.0 (2022-04-27)
|
2
|
+
|
3
|
+
Breaking changes:
|
4
|
+
- `PaperTrail::ActiveRecord` was renamed to `PaperTrail::ActiveRecordExt` to fix this error with paper_trail 12.3.0 / rails 7:
|
5
|
+
|
6
|
+
NameError:
|
7
|
+
uninitialized constant PaperTrail::ActiveRecord::Type
|
8
|
+
|
9
|
+
elsif PaperTrail::RAILS_GTE_7_0 && val.is_a?(ActiveRecord::Type::Time::Value)
|
10
|
+
|
1
11
|
## 0.1.2 (2020-04-27)
|
2
12
|
|
3
13
|
- Fix: Remove debug output
|
data/Readme.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# PaperTrail::
|
1
|
+
# PaperTrail::ActiveRecordExt
|
2
2
|
|
3
3
|
[![Gem Version][1]][2]
|
4
4
|
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://rdoc.info/github/TylerRick/paper_trail-active_record/master)
|
@@ -50,7 +50,7 @@ class Post
|
|
50
50
|
|
51
51
|
### Automatically add for all assocations
|
52
52
|
|
53
|
-
If you include `PaperTrail::
|
53
|
+
If you include `PaperTrail::ActiveRecordExt::OrDeleted` into a model, it will automatically add a `{association}_or_deleted`
|
54
54
|
method for every `belongs_to` or `has_one` association that is defined.
|
55
55
|
|
56
56
|
Because it reflects on all associations on that model as soon as it is included, make sure to
|
@@ -63,7 +63,7 @@ use [gem 'active_record_include'](https://github.com/TylerRick/active_record_inc
|
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
class ApplicationRecord < ActiveRecord::Base
|
66
|
-
include_when_connected PaperTrail::
|
66
|
+
include_when_connected PaperTrail::ActiveRecordExt::OrDeleted
|
67
67
|
```
|
68
68
|
|
69
69
|
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
|
-
require "paper_trail/
|
4
|
+
require "paper_trail/active_record"
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module PaperTrail::
|
1
|
+
module PaperTrail::ActiveRecordExt
|
2
2
|
|
3
3
|
# Extensions to ActiveRecord::Base to better support PaperTrail
|
4
4
|
module BaseExtensions
|
@@ -13,7 +13,7 @@ module BaseExtensions
|
|
13
13
|
else
|
14
14
|
Version.where(item_type: base_class.name, item_subtype: self.name)
|
15
15
|
end.tap do |versions|
|
16
|
-
PaperTrail::
|
16
|
+
PaperTrail::ActiveRecordExt.config.versions_extends.each do |mod|
|
17
17
|
versions.extend(mod)
|
18
18
|
end
|
19
19
|
end
|
@@ -51,7 +51,7 @@ module BaseExtensions
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def has_many_versions(name, *args, **options)
|
54
|
-
has_many name, *args, class_name: 'Version', extend: PaperTrail::
|
54
|
+
has_many name, *args, class_name: 'Version', extend: PaperTrail::ActiveRecordExt.config.versions_extends, **options
|
55
55
|
end
|
56
56
|
|
57
57
|
# Creates associations for finding related versions — that is, versions for related/children
|
@@ -123,6 +123,6 @@ end
|
|
123
123
|
end
|
124
124
|
|
125
125
|
ActiveRecord::Base.class_eval do
|
126
|
-
include PaperTrail::
|
126
|
+
include PaperTrail::ActiveRecordExt::BaseExtensions
|
127
127
|
end
|
128
128
|
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'paper_trail/version_concern'
|
2
|
+
|
3
|
+
module PaperTrail::ActiveRecordExt
|
2
4
|
module VersionConcernExt
|
3
5
|
extend ActiveSupport::Concern
|
4
6
|
|
@@ -70,7 +72,7 @@ end
|
|
70
72
|
end
|
71
73
|
|
72
74
|
PaperTrail::VersionConcern.class_eval do
|
73
|
-
prepend PaperTrail::
|
74
|
-
include PaperTrail::
|
75
|
+
prepend PaperTrail::ActiveRecordExt::VersionConcernExt
|
76
|
+
include PaperTrail::ActiveRecordExt::VersionConcernExt
|
75
77
|
end
|
76
78
|
|
@@ -1,4 +1,6 @@
|
|
1
|
+
require 'active_record'
|
1
2
|
require 'paper_trail'
|
3
|
+
require 'paper_trail/frameworks/active_record'
|
2
4
|
|
3
5
|
require_relative 'active_record/version'
|
4
6
|
|
@@ -8,7 +10,7 @@ require_relative 'active_record/or_deleted'
|
|
8
10
|
require_relative 'active_record/version_extensions'
|
9
11
|
|
10
12
|
module PaperTrail
|
11
|
-
module
|
13
|
+
module ActiveRecordExt
|
12
14
|
class << self
|
13
15
|
def configuration
|
14
16
|
@configuration ||= Configuration.new
|
@@ -5,7 +5,7 @@ require "paper_trail/active_record/version"
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "paper_trail-active_record"
|
8
|
-
spec.version = PaperTrail::
|
8
|
+
spec.version = PaperTrail::ActiveRecordExt.version
|
9
9
|
spec.authors = ["Tyler Rick"]
|
10
10
|
spec.email = ["tyler@tylerrick.com"]
|
11
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_trail-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Rick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paper_trail
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
- !ruby/object:Gem::Version
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.3.3
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: Various ActiveRecord extensions to make your life easier when working with
|