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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9bcb2bcc3f11278f88a3bb50be78b459819fb7f
4
- data.tar.gz: e1910af141550b7eb50534ac609c1657e1244b0a
3
+ metadata.gz: 1bb700958327ccb49035e1f8d2f41f67ba4695fa
4
+ data.tar.gz: 8e3c24ef49b796468820eda75a17c16f5f704418
5
5
  SHA512:
6
- metadata.gz: 7a76e4478486f1680b5b534c614a3d0b2ce5055be3c17c671fd29c432795c44b691a565e43f6b9f8e5e0572a34874274ac0f0b737c743c9e11cf8d94cec3538f
7
- data.tar.gz: e88fa62c9009e507ce356163093a2c1ac1bf8be4f896c58ba51c04e9ed2a81db7ce6d8ca02eb2bdc527f32a43efec3ed6e28e6a727d84855c97952a265d1dcb1
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
- set(name, klass.new(v))
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
@@ -1,3 +1,3 @@
1
1
  module Frenchy
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
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-21 00:00:00.000000000 Z
11
+ date: 2014-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel