freyja 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/freyja/base.rb +2 -2
- data/lib/freyja/version.rb +1 -1
- metadata +1 -1
data/lib/freyja/base.rb
CHANGED
@@ -68,7 +68,7 @@ class Freyja::Base
|
|
68
68
|
else
|
69
69
|
value = source[attr]
|
70
70
|
end
|
71
|
-
if association[:class]
|
71
|
+
if association[:class] && value.present?
|
72
72
|
translator = association[:class].new(value)
|
73
73
|
result[attr] = translator.as_json
|
74
74
|
else
|
@@ -87,7 +87,7 @@ class Freyja::Base
|
|
87
87
|
else
|
88
88
|
value = source[attr]
|
89
89
|
end
|
90
|
-
if association[:class]
|
90
|
+
if association[:class] && value.present?
|
91
91
|
result[attr] = value.map do |v|
|
92
92
|
translator = association[:class].new(v)
|
93
93
|
translator.as_json
|
data/lib/freyja/version.rb
CHANGED