acts_as_scrubbable 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78252290fb94891806ebaa7b4bc32b66b8bfe330
4
- data.tar.gz: 558c1d23f1e98491dd3916f91f29934b390d0d0c
3
+ metadata.gz: 0d0708b625d3e444bca4be963af07c74d02239c6
4
+ data.tar.gz: 3771c342bcaa6ac11331a503676ddae6b35bb69a
5
5
  SHA512:
6
- metadata.gz: 3c18426c1ebcc06348824ad624db3624a5b6b6a9538eadf86a4d642ac5b3586d17e8aa4f2b1f5048f90de8c190ba19104955345bc3e48d0be1533509954ea664
7
- data.tar.gz: e8703d9c6667d678b37faaf4152bcec0f569006efa1c84a901bde317c46dcc1878686e8c16dbabe7aa7e13fd207420a8f3eafb53c2047c716129ca2adcc5b140
6
+ metadata.gz: 113abcd20266ff0a770f8cffdd25ac16412ced0877c79d561994b7ca982dec0606b3f6bc847338277482fb543652af7bdd3d7d6e3a0f15b39a0172c555b55bee
7
+ data.tar.gz: eea96ae2991343c8a0b63b65a00f284954c19835771582b5de9b74eddca3b5871b4a7e4fbc906e7e91b9acaa8e6a8925172b620ac2c8fc96103ef5ed027463ad
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts_as_scrubbable (0.0.2)
4
+ acts_as_scrubbable (0.0.7)
5
5
  activerecord (~> 4.1)
6
6
  activesupport (~> 4.1)
7
7
  faker (~> 1.4)
8
8
  highline (~> 1.7)
9
+ parallel (~> 1.6)
9
10
  railties (~> 4.1)
10
11
  term-ansicolor (~> 1.3)
11
12
 
@@ -44,7 +45,7 @@ GEM
44
45
  columnize (0.9.0)
45
46
  diff-lcs (1.2.5)
46
47
  erubis (2.7.0)
47
- faker (1.4.3)
48
+ faker (1.5.0)
48
49
  i18n (~> 0.5)
49
50
  ffi (1.9.10)
50
51
  formatador (0.2.5)
@@ -75,6 +76,7 @@ GEM
75
76
  notiffany (0.0.8)
76
77
  nenv (~> 0.1)
77
78
  shellany (~> 0.0)
79
+ parallel (1.6.1)
78
80
  pry (0.10.3)
79
81
  coderay (~> 1.1.0)
80
82
  method_source (~> 0.8.1)
@@ -114,7 +116,7 @@ GEM
114
116
  terminal-notifier-guard (1.6.4)
115
117
  thor (0.19.1)
116
118
  thread_safe (0.3.5)
117
- tins (1.6.0)
119
+ tins (1.7.0)
118
120
  tzinfo (1.2.2)
119
121
  thread_safe (~> 0.1)
120
122
 
data/README.md CHANGED
@@ -25,6 +25,10 @@ class User < ActiveRecord::Base
25
25
 
26
26
  acts_as_scrubbable :first_name, :last_name
27
27
 
28
+
29
+ # optionally you can add a scope to limit the rows to update
30
+ scope :scrubbable_scope, -> { where(some_value: true) }
31
+
28
32
  ...
29
33
  end
30
34
  ```
@@ -39,7 +39,11 @@ namespace :scrub do
39
39
  scrubbed_count = 0
40
40
 
41
41
  ActiveRecord::Base.connection_pool.with_connection do
42
- ar_class.find_in_batches(batch_size: 1000) do |batch|
42
+
43
+ relation = ar_class.scoped
44
+ relation = relation.send(:scrubbable_scope) if ar_class.respond_to?(:scrubbable_scope)
45
+
46
+ relation.find_in_batches(batch_size: 1000) do |batch|
43
47
  ActiveRecord::Base.transaction do
44
48
  batch.each do |obj|
45
49
  obj.scrub!
@@ -1,3 +1,3 @@
1
1
  module ActsAsScrubbable
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_scrubbable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samer Masry