foreign_model 0.1.0 → 0.2.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{foreign_model}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mike Nicholaides"]
12
- s.date = %q{2010-04-02}
12
+ s.date = %q{2010-04-13}
13
13
  s.description = %q{Works for ActiveRecord and Mongoid}
14
14
  s.email = %q{mike@ablegray.com}
15
15
  s.extra_rdoc_files = [
data/lib/foreign_model.rb CHANGED
@@ -36,7 +36,7 @@ module ForeignModel
36
36
  end
37
37
 
38
38
  def #{name}
39
- @#{name} ||= parent_proc_for_#{name}.find(#{name}_id) if parent_proc_for_#{name} && #{name}_id
39
+ @#{name} ||= parent_proc_for_#{name}.find(#{name}_id) if parent_proc_for_#{name} && #{name}_id && #{name}_id != ""
40
40
  end
41
41
 
42
42
  def #{name}=(foreign_model)
@@ -58,13 +58,22 @@ describe "belongs_to_foreign_model" do
58
58
  end
59
59
 
60
60
  context "when nil" do
61
- it "should the assiated model should be nil" do
61
+ it "should make the assiated model should be nil" do
62
62
  @child = Child.new
63
63
  @child.parent_id = nil
64
64
 
65
65
  @child.parent.should be_nil
66
66
  end
67
67
  end
68
+
69
+ context "when blank" do
70
+ it "should make the assiated model should be nil" do
71
+ @child = Child.new
72
+ @child.parent_id = ""
73
+
74
+ @child.parent.should be_nil
75
+ end
76
+ end
68
77
  end
69
78
 
70
79
  describe "with :scope => proc{...}" do
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mike Nicholaides
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-02 00:00:00 +00:00
17
+ date: 2010-04-13 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency