polyblock 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/polyblock/block.rb +10 -1
- data/lib/polyblock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05240a5a962e2ad7b6c0172c48ff0c1796de1990
|
4
|
+
data.tar.gz: ee083552560a4635714fb333bb397aae5a5700f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e6861b9cf59615cc45dcfa0e296decfd70cb30f7769d9d83db134e18bcd78caf99769498b8186503cb1e3e8523cc4325c71db0a4b32ca253be9ecdf87b17f2
|
7
|
+
data.tar.gz: 013fd350f4bcfe098898664e39b9012ba541445c40632ae767ece8d8da35f5dd0912d1601c752a9603e075294d2e8fb7e5214a405cd73e8bd6f33c0a382a699f
|
@@ -6,7 +6,16 @@ module Polyblock
|
|
6
6
|
belongs_to :contentable, :polymorphic => true, :dependent => :destroy
|
7
7
|
|
8
8
|
def self.import(pbs)
|
9
|
-
pbs.
|
9
|
+
outputs = pbs.map do |pb|
|
10
|
+
matches = Block.where :name => pb[:name]
|
11
|
+
if matches.any?
|
12
|
+
m = matches.first
|
13
|
+
m.update_attributes(pb) if m.content != pb[:content]
|
14
|
+
else
|
15
|
+
Block.create(pb)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
outputs.include?(false)
|
10
19
|
end
|
11
20
|
|
12
21
|
def self.export
|
data/lib/polyblock/version.rb
CHANGED