acts_as_sourceable 2.2.5 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_sourceable/acts_as_sourceable.rb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aff3b12654475296bed41fc3b462114f55c357a
|
4
|
+
data.tar.gz: 93e74bb093c6059aa3d816f065b1780ff2920390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1328c811e66a7767461088ad69a0c252ea03d9789a4a00cc0f2c10596acd75325a9111e4bb415f57c5f68a4da96a3b8d60edc223429fabb0763c7a0b77bb2af2
|
7
|
+
data.tar.gz: 97cfe2da91e9fe0d624efadcfabe1dcbf4cd448c7db30acdc95726794d8d8465b62f7e9fc171403c0489e6997d5292eb32d9f446dc246d1cd2e90e7b5c99dd1e
|
@@ -112,7 +112,9 @@ module ActsAsSourceable
|
|
112
112
|
|
113
113
|
sources = Array(sources).flatten
|
114
114
|
sources.each do |source|
|
115
|
-
|
115
|
+
entry = source_registry_entries(source).first_or_initialize
|
116
|
+
# touch existing RegistryEntry to keep track of "freshness" of the sourcing
|
117
|
+
entry.persisted? ? entry.touch : entry.save!
|
116
118
|
end
|
117
119
|
update_sourceable_cache_column(true) if sources.present?
|
118
120
|
end
|
@@ -124,7 +126,7 @@ module ActsAsSourceable
|
|
124
126
|
|
125
127
|
sources = Array(sources).flatten
|
126
128
|
sources.each do |source|
|
127
|
-
|
129
|
+
source_registry_entries(source).delete_all
|
128
130
|
end
|
129
131
|
update_sourceable_cache_column(false) if self.sourceable_registry_entries.empty?
|
130
132
|
end
|
@@ -132,8 +134,8 @@ module ActsAsSourceable
|
|
132
134
|
|
133
135
|
private
|
134
136
|
|
135
|
-
def
|
136
|
-
|
137
|
+
def source_registry_entries(source)
|
138
|
+
sourceable_registry_entries.where(:source_type => source.class, :source_id => source.id)
|
137
139
|
end
|
138
140
|
|
139
141
|
def update_sourceable_cache_column(value = nil)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_sourceable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jakobsen
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.4.6
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: perform garbage collection on categories that are no longer referenced
|