platanus 0.0.28 → 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/platanus/stacked.rb +5 -3
- data/lib/platanus/version.rb +1 -1
- metadata +2 -2
data/lib/platanus/stacked.rb
CHANGED
@@ -37,14 +37,16 @@ module Platanus
|
|
37
37
|
elsif self.column_names.include? "#{top_value_prop}_id"
|
38
38
|
belongs_to top_value_prop.to_sym, class_name: tname_class
|
39
39
|
else
|
40
|
+
instance_var = "@_last_#{tname_single}".to_sym
|
40
41
|
send :define_method, top_value_prop do
|
41
42
|
# Storing the last stacked value will not prevent race conditions
|
42
43
|
# when simultaneous updates occur.
|
43
|
-
|
44
|
-
|
44
|
+
last = instance_variable_get instance_var
|
45
|
+
return last unless last.nil?
|
46
|
+
instance_variable_set(instance_var, self.send(tname).first)
|
45
47
|
end
|
46
48
|
send :define_method, "#{top_value_prop}=" do |_top|
|
47
|
-
|
49
|
+
instance_variable_set(instance_var, _top)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
send :private, "#{top_value_prop}="
|
data/lib/platanus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platanus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.29
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Platan.us utility gem
|
15
15
|
email:
|