activerecord-redundancy 0.3.2 → 0.3.3

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: eaba9fab04a65cac33da01f3c7ad54f5865e2a2c
4
- data.tar.gz: 048c7a2d1e9dbdacfecba9fd2ba39de4a4b08864
3
+ metadata.gz: 5e68d174487cbdb7ec2061bf60b3a39058f645fa
4
+ data.tar.gz: c6a6434b61bc4cd1275a1cf4529b36e19b35640b
5
5
  SHA512:
6
- metadata.gz: 259c64cfef4a3356294e964b661607f615d7c02ba1ef66943003d61cbe9d11603cd15cc1112ed4a4405fe35d837aaca4f8d6ab965cdb44c08e4445637c0593f8
7
- data.tar.gz: 90ec954829fd633d61f8224179528f55e77bf12340c2723cfd7564aeb356e546e570a9919ca6387dfc05b1cd7bff23afe07bfe74fda94e779d2c8b0fe7b923c4
6
+ metadata.gz: 9875b90b5647087742c36a47d6e2ed9d179afa5f428352dda99a655179d4b882e44fed248d5629941828c7a7268f01185c7ee9a4d2acaac69b0e469b9788c619
7
+ data.tar.gz: 918fee0e77240ed84720392af096f75d8138071606e28dd3ff49efa66466a7b796622d48f9b4bd87aac26c1dec21a8cb1e203bd97735fdb58f4e08b63a7c9469
data/lib/redundancy.rb CHANGED
@@ -4,26 +4,26 @@ module Redundancy
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- before_save :update_redundacies_before_save
8
- after_save :update_redundacies_after_save
7
+ before_save :update_redundancies_before_save
8
+ after_save :update_redundancies_after_save
9
9
  end
10
10
 
11
11
  private
12
12
 
13
- def update_redundacies_before_save
14
- self.class.redundacies.each do |redundancy|
13
+ def update_redundancies_before_save
14
+ self.class.redundancies.each do |redundancy|
15
15
  redundancy.before_save(self)
16
16
  end
17
17
  end
18
18
 
19
- def update_redundacies_after_save
20
- self.class.redundacies.each do |redundancy|
19
+ def update_redundancies_after_save
20
+ self.class.redundancies.each do |redundancy|
21
21
  redundancy.after_save(self)
22
22
  end
23
23
  end
24
24
 
25
- def update_redundacies
26
- self.class.redundacies.each do |redundancy|
25
+ def update_redundancies
26
+ self.class.redundancies.each do |redundancy|
27
27
  redundancy.force_update!(self)
28
28
  end
29
29
  end
@@ -39,13 +39,13 @@ module Redundancy
39
39
  Utils.cache_method self, association, attribute, options
40
40
  end
41
41
 
42
- def redundacies
43
- @redundacies ||= []
42
+ def redundancies
43
+ @redundancies ||= []
44
44
  end
45
45
 
46
- def update_redundacies
46
+ def update_redundancies
47
47
  all.each do |record|
48
- redundacies.each do |redundancy|
48
+ redundancies.each do |redundancy|
49
49
  redundancy.force_update!(record)
50
50
  end
51
51
  end
@@ -23,20 +23,20 @@ module Redundancy
23
23
 
24
24
  case reflection.macro
25
25
  when :belongs_to
26
- local_klass.redundacies << UpdateColumn.new(
26
+ local_klass.redundancies << UpdateColumn.new(
27
27
  source: { association: association, attribute: attribute },
28
28
  dest: { association: nil, attribute: cache_column },
29
29
  change_if: foreign_key, klass: local_klass
30
30
  )
31
31
 
32
32
  when :has_one
33
- remote_klass.redundacies << UpdateColumn.new(
33
+ remote_klass.redundancies << UpdateColumn.new(
34
34
  source: { association: nil, attribute: attribute, nil_unless: foreign_key },
35
35
  dest: { association: inverse_association, attribute: cache_column },
36
36
  change_if: foreign_key, klass: remote_klass
37
37
  )
38
38
 
39
- remote_klass.redundacies << UpdatePrevColumn.new(
39
+ remote_klass.redundancies << UpdatePrevColumn.new(
40
40
  source: options[:default],
41
41
  dest: { klass: local_klass, prev_id: foreign_key, attribute: cache_column },
42
42
  change_if: foreign_key, klass: remote_klass
@@ -44,7 +44,7 @@ module Redundancy
44
44
 
45
45
  end
46
46
 
47
- remote_klass.redundacies << UpdateColumn.new(
47
+ remote_klass.redundancies << UpdateColumn.new(
48
48
  source: { association: nil, attribute: attribute },
49
49
  dest: { association: inverse_association, attribute: cache_column },
50
50
  change_if: attribute, klass: remote_klass, update: true
@@ -63,13 +63,13 @@ module Redundancy
63
63
 
64
64
  cache_method = options[:cache_method] || :"raw_#{attribute}"
65
65
 
66
- local_klass.redundacies << UpdateMethod.new(
66
+ local_klass.redundancies << UpdateMethod.new(
67
67
  source: { attribute: cache_method },
68
68
  dest: { association: association, attribute: attribute },
69
69
  change_if: options[:change_if], klass: local_klass
70
70
  )
71
71
 
72
- local_klass.redundacies << UpdatePrevMethod.new(
72
+ local_klass.redundancies << UpdatePrevMethod.new(
73
73
  source: { attribute: cache_method },
74
74
  dest: { klass: remote_klass, prev_id: foreign_key, attribute: attribute },
75
75
  change_if: foreign_key, klass: local_klass
@@ -1,3 +1,3 @@
1
1
  module Redundancy
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-redundancy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord