mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
serializable_hash and as_json should take options = nil
per ActiveModel::Serialization#serializable_hash
96bb004fc6/activemodel/lib/active_model/serialization.rb
def serializable_hash(options = nil)
options ||= {}
Otherwise, passing in nil to `as_json` or `serializable_hash`
makes things blow up when passing nil into attributes
This commit is contained in:
@@ -16,11 +16,11 @@ module ActiveModel
|
||||
@options = options
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
def serializable_hash(options = nil)
|
||||
raise NotImplementedError, 'This is an abstract method. Should be implemented at the concrete adapter.'
|
||||
end
|
||||
|
||||
def as_json(options = {})
|
||||
def as_json(options = nil)
|
||||
hash = serializable_hash(options)
|
||||
include_meta(hash) unless self.class == FlattenJson
|
||||
hash
|
||||
|
||||
Reference in New Issue
Block a user