We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6684fe2 commit 50147d4Copy full SHA for 50147d4
lib/mongoid/fields/localized.rb
@@ -15,7 +15,10 @@ class Localized < Standard
15
# @return [ Object ] The value for the current locale.
16
def demongoize(object)
17
return if object.nil?
18
- type.demongoize(lookup(object))
+ case object
19
+ when Hash
20
+ type.demongoize(lookup(object))
21
+ end
22
end
23
24
# Is the field localized or not?
spec/mongoid/fields/localized_spec.rb
@@ -113,6 +113,18 @@
113
114
115
116
+
117
+ context "passing a bogus value" do
118
119
+ let(:value) do
120
+ field.demongoize("bogus")
121
122
123
+ it "returns nil" do
124
+ expect(value).to be_nil
125
126
127
128
context "when the value does not exist" do
129
130
context "when not using fallbacks" do
0 commit comments