cocoon 1.0.21 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.21
1
+ 1.0.22
data/cocoon.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cocoon"
8
- s.version = "1.0.21"
8
+ s.version = "1.0.22"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Van der Auwera"]
12
- s.date = "2012-05-09"
12
+ s.date = "2012-05-20"
13
13
  s.description = "Unobtrusive nested forms handling, using jQuery. Use this and discover cocoon-heaven."
14
14
  s.email = "nathan@dixis.com"
15
15
  s.extra_rdoc_files = [
@@ -86,10 +86,16 @@ module Cocoon
86
86
  def create_object(f, association)
87
87
  assoc = f.object.class.reflect_on_association(association)
88
88
 
89
- if assoc.collection?
90
- f.object.send(association).build
89
+ if assoc.class.name == "Mongoid::Relations::Metadata"
90
+ conditions = assoc.respond_to?(:conditions) ? assoc.conditions.flatten : []
91
+ assoc.klass.new(*conditions)
91
92
  else
92
- f.object.send("build_#{association}")
93
+ # assume ActiveRecord or compatible
94
+ if assoc.collection?
95
+ f.object.send(association).build
96
+ else
97
+ f.object.send("build_#{association}")
98
+ end
93
99
  end
94
100
  end
95
101
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 21
10
- version: 1.0.21
9
+ - 22
10
+ version: 1.0.22
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Van der Auwera
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-09 00:00:00 Z
18
+ date: 2012-05-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement