Skip to content

Commit

Permalink
make hash conversions work with Ruby 1.9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Azdaroth committed Sep 22, 2016
1 parent c02a419 commit f041424
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/jsonapi-serializers/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ def self.serialize(objects, options = {})
includes = options[:include]
includes = (includes.is_a?(String) ? includes.split(',') : includes).uniq if includes

fields = options[:fields].to_h.map do |type, whitelisted_fields|
fields = options[:fields] || {}
fields = Hash[fields.map do |type, whitelisted_fields|
[type.to_s, whitelisted_fields.split(",").map(&:to_sym)]
end.to_h
end]

# An internal-only structure that is passed through serializers as they are created.
passthrough_options = {
Expand Down

0 comments on commit f041424

Please sign in to comment.