frenchy 0.0.4 → 0.0.5
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 +6 -2
- data/lib/frenchy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bb700958327ccb49035e1f8d2f41f67ba4695fa
|
4
|
+
data.tar.gz: 8e3c24ef49b796468820eda75a17c16f5f704418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c1cd4486c8dfc647e4e1a0326a0a4864a09ae2605cf9b1bb8f894678edb900b04e9451c12a5ef6ff92f3403adc1749b0fc0f3cde7156b0106917e9cd032047
|
7
|
+
data.tar.gz: 7f27293f2b2073fe20ceefe12a207b8d182e63c3e2daee00129ad422df60e92bc5a17fa719f9a96d27c49232c459abc1705308b038d900a456fbb3b1b7748333
|
data/lib/frenchy/model.rb
CHANGED
@@ -13,7 +13,7 @@ module Frenchy
|
|
13
13
|
|
14
14
|
# Create a new instance of this model with the given attributes
|
15
15
|
def initialize(attrs={})
|
16
|
-
self.class.defaults.merge(attrs).each do |k,v|
|
16
|
+
self.class.defaults.merge((attrs || {}).reject {|k,v| v.nil? }).each do |k,v|
|
17
17
|
if self.class.fields[k.to_sym]
|
18
18
|
send("#{k}=", v)
|
19
19
|
end
|
@@ -125,7 +125,11 @@ module Frenchy
|
|
125
125
|
if options[:many]
|
126
126
|
set(name, Frenchy::Collection.new(Array(v).map {|vv| klass.new(vv)}))
|
127
127
|
else
|
128
|
-
|
128
|
+
if v.is_a?(Hash)
|
129
|
+
set(name, klass.new(v))
|
130
|
+
else
|
131
|
+
set(name, v)
|
132
|
+
end
|
129
133
|
end
|
130
134
|
end
|
131
135
|
end
|
data/lib/frenchy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frenchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Coene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|