paper_trail-active_record 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e424c0dbb41ccae430a47d5edbdaaf42267f4789c9bda011c50e97841a8b3596
4
- data.tar.gz: 89a7021a5fa8141ddc07167c6f7ee8ce1e04ca64135dee976b9e730c89e3773d
3
+ metadata.gz: 28bf423183511f3a2c63c11421acfec27790f6a99985db9cf25898ab06e54f00
4
+ data.tar.gz: 6e470451542d115789496c6c91e8af14245d596fda5afba1ca0a6434c64e3b39
5
5
  SHA512:
6
- metadata.gz: 8d2e504931134b961b3c750312e80f14e00909cb3fbfab616c0fdc6ff08de6bd9388de86bad8861022980c7f6737c4964fe7d144986167a89c3719b24f79b097
7
- data.tar.gz: '093d5bcb1f5f59e0753d19f30c7564f48ccea1408bea59b056c84325e52351a93c175666b072f3fbff33d0cf8a9f34c62b8937cac2ea86419c0937db4f719631'
6
+ metadata.gz: e8f66e1ca525037858352c503a30793cada982d88c2c103132f99e8b087cfa971b330f42ff2e26b54dd7fda3472aa68d49a89f9a4c9ee64118d87e5a887347fd
7
+ data.tar.gz: 47c68747e77bacdd68210e07e13f458631a7e15d532e79439fc9a14e891a93bf6874889647e0ee9aaef72f58d7be7f3c992a355be54bf0887d7576c006166669
@@ -1,3 +1,7 @@
1
+ ## 0.1.2 (2020-04-27)
2
+
3
+ - Fix: Remove debug output
4
+
1
5
  ## 0.1.1 (2020-04-23)
2
6
 
3
7
  - Fix: `has_many_versions` was passing wrong value for extends
data/Readme.md CHANGED
@@ -3,8 +3,8 @@
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)
5
5
 
6
- An extension to [PaperTrail](https://github.com/paper-trail-gem/paper_trail)
7
- that adds some useful extensions to models that have `has_paper_trail` and to the Version model.
6
+ Various ActiveRecord extensions to make your life easier when working with
7
+ [PaperTrail](https://github.com/paper-trail-gem/paper_trail) versions and versioned model records.
8
8
 
9
9
  ## Methods added to models with `has_paper_trail`
10
10
 
@@ -27,25 +27,7 @@ that adds some useful extensions to models that have `has_paper_trail` and to th
27
27
  - `#action`
28
28
  - `#item_class`
29
29
 
30
- ## `OrDeleted`
31
-
32
- If you include this module into a model, it will automatically add a `{association}_or_deleted`
33
- method for every `belongs_to` or `has_one` association that is defined.
34
-
35
- Because it reflects on all associations on that model as soon as it is included, make sure to
36
- include it *after* all of your associations are defined.
37
-
38
- If you want more control, and don't want it to add anything automatically, you can manually call
39
- `define_assoc_or_deleted :association` for each association that you want to have a
40
- `{association}_or_deleted` method.
41
-
42
- If you want it to automatically be added for all assocations on *all* application models, you can
43
- use [gem 'active_record_include'](https://github.com/TylerRick/active_record_include) like this:
44
-
45
- ```ruby
46
- class ApplicationRecord < ActiveRecord::Base
47
- include_when_connected PaperTrail::ActiveRecord::OrDeleted
48
- ```
30
+ ## `{association}_or_deleted`
49
31
 
50
32
  ### `def define_assoc_or_deleted(assoc_name, suffix: nil)`
51
33
 
@@ -66,6 +48,23 @@ class Post
66
48
  define_assoc_or_deleted :author, suffix: nil
67
49
  ```
68
50
 
51
+ ### Automatically add for all assocations
52
+
53
+ If you include `PaperTrail::ActiveRecord::OrDeleted` into a model, it will automatically add a `{association}_or_deleted`
54
+ method for every `belongs_to` or `has_one` association that is defined.
55
+
56
+ Because it reflects on all associations on that model as soon as it is included, make sure to
57
+ include it *after* all of your associations are defined. You can also call
58
+ `define_assoc_or_deleted_on_all_associations` at the end of your model class (that is the same
59
+ method that including the module triggers).
60
+
61
+ If you want it to automatically be added for all assocations on *all* application models, you can
62
+ use [gem 'active_record_include'](https://github.com/TylerRick/active_record_include) like this:
63
+
64
+ ```ruby
65
+ class ApplicationRecord < ActiveRecord::Base
66
+ include_when_connected PaperTrail::ActiveRecord::OrDeleted
67
+ ```
69
68
 
70
69
 
71
70
  ## Installation
@@ -69,7 +69,7 @@ module OrDeleted
69
69
 
70
70
  def define_assoc_or_deleted_on_all_associations(suffix: 'or_deleted')
71
71
  reflect_on_all_associations.each do |reflection|
72
- puts %(#{self}.reflection.name=#{(reflection.name).inspect})
72
+ #puts %(#{self}.reflection.name=#{(reflection.name).inspect})
73
73
  next if reflection.collection?
74
74
 
75
75
  assoc_name = reflection.name
@@ -1,7 +1,7 @@
1
1
  module PaperTrail
2
2
  module ActiveRecord
3
3
  def self.version
4
- "0.1.1"
4
+ "0.1.2"
5
5
  end
6
6
  end
7
7
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Tyler Rick"]
10
10
  spec.email = ["tyler@tylerrick.com"]
11
11
 
12
- spec.summary = %q{Various ActiveRecord extensions}
12
+ spec.summary = %q{Various ActiveRecord extensions to make your life easier when working with PaperTrail versions}
13
13
  spec.description = spec.summary
14
14
  spec.homepage = "https://github.com/TylerRick/#{spec.name}"
15
15
 
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Rick
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-24 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paper_trail
@@ -136,7 +136,8 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description: Various ActiveRecord extensions
139
+ description: Various ActiveRecord extensions to make your life easier when working
140
+ with PaperTrail versions
140
141
  email:
141
142
  - tyler@tylerrick.com
142
143
  executables: []
@@ -185,5 +186,6 @@ requirements: []
185
186
  rubygems_version: 3.0.3
186
187
  signing_key:
187
188
  specification_version: 4
188
- summary: Various ActiveRecord extensions
189
+ summary: Various ActiveRecord extensions to make your life easier when working with
190
+ PaperTrail versions
189
191
  test_files: []