ninja-model 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -77,8 +77,16 @@ module NinjaModel
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
def collection_accessor_methods(reflection, association_proxy_class)
|
80
|
+
def collection_accessor_methods(reflection, association_proxy_class, writer = true)
|
81
81
|
collection_reader_method(reflection, association_proxy_class)
|
82
|
+
|
83
|
+
if writer
|
84
|
+
redefine_method("#{reflection.name}=") do |new_value|
|
85
|
+
association = send(reflection.name)
|
86
|
+
association.replace(new_value)
|
87
|
+
association
|
88
|
+
end
|
89
|
+
end
|
82
90
|
end
|
83
91
|
|
84
92
|
def collection_reader_method(reflection, association_proxy_class)
|
@@ -107,7 +107,8 @@ module NinjaModel
|
|
107
107
|
@proxy ||= begin
|
108
108
|
self.class.proxy.instance(self)
|
109
109
|
end
|
110
|
-
@proxy.attributes = self.attributes
|
110
|
+
@proxy.attributes = self.attributes #.delete_if { |k,v| k.eql?('id') }
|
111
|
+
@proxy.id = self.id
|
111
112
|
@proxy
|
112
113
|
end
|
113
114
|
end
|
data/lib/ninja_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninja-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Williams
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-01 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|