Skip to content

Commit 341d552

Browse files
Make sure serialization_options is never nil
1 parent f385ab0 commit 341d552

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/active_model/serializer.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ def convert_keys(hash)
273273
end]
274274
end
275275

276-
attr_accessor :serialization_options
276+
attr_writer :serialization_options
277+
def serialization_options
278+
@serialization_options || {}
279+
end
277280

278281
def serializable_object(options={})
279282
self.serialization_options = options

0 commit comments

Comments
 (0)