frenchy 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/frenchy/model.rb +4 -1
- data/lib/frenchy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9bcb2bcc3f11278f88a3bb50be78b459819fb7f
|
4
|
+
data.tar.gz: e1910af141550b7eb50534ac609c1657e1244b0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a76e4478486f1680b5b534c614a3d0b2ce5055be3c17c671fd29c432795c44b691a565e43f6b9f8e5e0572a34874274ac0f0b737c743c9e11cf8d94cec3538f
|
7
|
+
data.tar.gz: e88fa62c9009e507ce356163093a2c1ac1bf8be4f896c58ba51c04e9ed2a81db7ce6d8ca02eb2bdc527f32a43efec3ed6e28e6a727d84855c97952a265d1dcb1
|
data/lib/frenchy/model.rb
CHANGED
@@ -117,9 +117,12 @@ module Frenchy
|
|
117
117
|
options[:many] = (name.to_s.singularize != name.to_s) unless options.key?(:many)
|
118
118
|
klass = options[:class_name].constantize
|
119
119
|
|
120
|
+
if options[:many]
|
121
|
+
options[:default] ||= []
|
122
|
+
end
|
123
|
+
|
120
124
|
define_method("#{name}=") do |v|
|
121
125
|
if options[:many]
|
122
|
-
options[:default] ||= []
|
123
126
|
set(name, Frenchy::Collection.new(Array(v).map {|vv| klass.new(vv)}))
|
124
127
|
else
|
125
128
|
set(name, klass.new(v))
|
data/lib/frenchy/version.rb
CHANGED