couch_potato 0.2.21 → 0.2.22

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -2,4 +2,4 @@
2
2
  :build:
3
3
  :major: 0
4
4
  :minor: 2
5
- :patch: 21
5
+ :patch: 22
@@ -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.blank? && options[:default]
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.21
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-13 00:00:00 +01:00
12
+ date: 2010-01-19 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency