Skip to content

Commit

Permalink
Don't raise an error when included field can't be retrieved.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiNyzhnyk authored and AndriiNyzhnyk committed May 25, 2018
1 parent b3beb56 commit 5d64d31
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 @@ -294,7 +294,8 @@ def self.serialize(objects, options = {})
namespace: options[:namespace],
include: includes,
fields: fields,
base_url: options[:base_url]
base_url: options[:base_url],
skip_included_check: options[:skip_included_check]
}

if !options[:skip_collection_check] && options[:is_collection] && !objects.respond_to?(:each)
Expand Down Expand Up @@ -470,7 +471,7 @@ def self.find_recursive_relationships(root_object, root_inclusion_tree, results,
object = serializer.has_many_relationship(unformatted_attr_name, attr_data)
end

if !is_valid_attr
if !options[:skip_included_check] && !is_valid_attr
raise JSONAPI::Serializer::InvalidIncludeError.new(
"'#{attribute_name}' is not a valid include.")
end
Expand Down

0 comments on commit 5d64d31

Please sign in to comment.