plant 0.2.0 → 0.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bba9b538452eac1f4dfaefeb3f4c7a8c1c4a991a
|
4
|
+
data.tar.gz: f04525ade799e3f18ffff45adcdd2e7153f34372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bd0763eaf431fe891871e191527f83dea46ebc9478279f01cb866b1a14e4f063ae27ded0d06ff884358e56445017fe0e538f1f3611f8d84d713db1f2ade9e92
|
7
|
+
data.tar.gz: 739f7e7af8fce53bfbc50a9cf8ff670dfb27b87588cb4bb955545bd6879772447ebb03c573cf38adcbe3db3a1cabdf66039cbd735f132f78e0f876631f774a47
|
data/app/models/plant/content.rb
CHANGED
@@ -15,19 +15,16 @@ module Plant
|
|
15
15
|
scenario = scenario.scenario if scenario.respond_to? :scenario
|
16
16
|
specific = where(node_id: "#{node}.#{scenario}").first
|
17
17
|
return specific.content if specific
|
18
|
-
|
18
|
+
find_main(node)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def add_main
|
29
|
-
append = scenario ? scenario : 'main'
|
30
|
-
self.node_id += ".#{append}" unless node_id.ends_with?(append)
|
21
|
+
def self.find_main(node)
|
22
|
+
main = find_by(node_id: "#{node}.main")
|
23
|
+
return main.content if main
|
24
|
+
find_by!(node_id: "#{node}").content
|
31
25
|
end
|
26
|
+
|
27
|
+
# Can only have one scenario-node_id combination
|
28
|
+
validates_uniqueness_of :node_id
|
32
29
|
end
|
33
30
|
end
|
data/lib/plant/version.rb
CHANGED