mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
remove unncessary is_a?(Hash) check
This commit is contained in:
parent
d956507482
commit
c898e3daf9
@ -53,9 +53,7 @@ module ActiveModel
|
||||
@options[:unique_values] = {}
|
||||
|
||||
array = serializable_array.map do |item|
|
||||
if item.is_a?(Hash)
|
||||
item
|
||||
elsif item.respond_to?(:serializable_hash)
|
||||
if item.respond_to?(:serializable_hash)
|
||||
item.serializable_hash
|
||||
else
|
||||
item.as_json
|
||||
|
||||
@ -408,7 +408,7 @@ class SerializerTest < ActiveModel::TestCase
|
||||
hash = {:value => "something"}
|
||||
array = [hash]
|
||||
serializer = array.active_model_serializer.new(array, :root => :items)
|
||||
assert_equal({ :items => [ hash ]}, serializer.as_json)
|
||||
assert_equal({ :items => [ hash.as_json ]}, serializer.as_json)
|
||||
end
|
||||
|
||||
class CustomBlog < Blog
|
||||
|
||||
Loading…
Reference in New Issue
Block a user