active_node 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,5 +15,15 @@ module ActiveNode::Associations::Builder
|
|
15
15
|
end
|
16
16
|
CODE
|
17
17
|
end
|
18
|
+
|
19
|
+
def define_writers
|
20
|
+
super
|
21
|
+
|
22
|
+
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
23
|
+
def #{name}_id=(value)
|
24
|
+
association(:#{name}).id_writer(value)
|
25
|
+
end
|
26
|
+
CODE
|
27
|
+
end
|
18
28
|
end
|
19
29
|
end
|
data/lib/active_node/version.rb
CHANGED
@@ -92,6 +92,14 @@ describe ActiveNode::Associations do
|
|
92
92
|
father.children.should == [child]
|
93
93
|
end
|
94
94
|
|
95
|
+
it 'can set has_one relation by id' do
|
96
|
+
father = Person.create!
|
97
|
+
child = Person.create!
|
98
|
+
child.father_id = father.id
|
99
|
+
child.save
|
100
|
+
father.children.should == [child]
|
101
|
+
end
|
102
|
+
|
95
103
|
it "can access new association without being saved" do
|
96
104
|
father = Person.create!
|
97
105
|
child = Person.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_node
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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: 2013-10-
|
12
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_attr
|