Skip to content

Commit 923a803

Browse files
committed
Update to match suggested changes
1 parent 51d2c2f commit 923a803

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/jsonapi_errorable/validatable.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
module JsonapiErrorable
22
module Validatable
3-
# @param relationships: nil [Hash] list of relationships to be serialized as errors
3+
# @param relationships: nil [ Hash or FalseClass ] list of relationships whose errors should be serialized
4+
# Defaults to the deserialized data.relationships of Json:api Payload
45
# @param record [ ActiveModel ] Object that implements ActiveModel
56
def render_errors_for(record, relationships: nil)
6-
validation = Serializers::Validation.new(
7-
record,
7+
8+
relationships = if relationships == false
9+
{}
10+
else
811
relationships || deserialized_params.relationships
9-
)
10-
12+
end
13+
14+
validation = Serializers::Validation.new(record, relationships)
1115

1216
render \
1317
json: { errors: validation.errors },

0 commit comments

Comments
 (0)