couch_potato 0.2.21 → 0.2.22
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.
- data/CHANGES.md +3 -0
- data/VERSION.yml +1 -1
- data/lib/couch_potato/persistence/simple_property.rb +1 -1
- data/spec/default_property_spec.rb +5 -1
- metadata +2 -2
data/CHANGES.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
## Changes
|
2
2
|
|
3
|
+
### 0.2.22
|
4
|
+
* fixed properties with default values returned default when a blank value like '' or [] was set (langalex)
|
5
|
+
|
3
6
|
### 0.2.21
|
4
7
|
* automatically set a database instance on results of CouchPotato::Database#view (langalex)
|
5
8
|
* improved auto loading of unloaded constants - can now load constants that have never been loaded before (langalex)
|
data/VERSION.yml
CHANGED
@@ -48,7 +48,7 @@ module CouchPotato
|
|
48
48
|
|
49
49
|
define_method "#{name}" do
|
50
50
|
value = self.instance_variable_get("@#{name}")
|
51
|
-
if value.
|
51
|
+
if value.nil? && options[:default]
|
52
52
|
default = clone_attribute(options[:default])
|
53
53
|
self.instance_variable_set("@#{name}", default)
|
54
54
|
default
|
@@ -4,7 +4,7 @@ class Test
|
|
4
4
|
include CouchPotato::Persistence
|
5
5
|
|
6
6
|
property :test, :default => 'Test value'
|
7
|
-
property :complex, :default => []
|
7
|
+
property :complex, :default => [1, 2, 3]
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'default properties' do
|
@@ -31,4 +31,8 @@ describe 'default properties' do
|
|
31
31
|
t2 = Test.new
|
32
32
|
t.complex.object_id.should_not == t2.complex.object_id
|
33
33
|
end
|
34
|
+
|
35
|
+
it "should not return the default value when the actual value is empty" do
|
36
|
+
t = Test.new(:complex => []).complex.should == []
|
37
|
+
end
|
34
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couch_potato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Lang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-19 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|