File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
module JsonapiErrorable
2
2
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
4
5
# @param record [ ActiveModel ] Object that implements ActiveModel
5
6
def render_errors_for ( record , relationships : nil )
6
- validation = Serializers ::Validation . new (
7
- record ,
7
+
8
+ relationships = if relationships == false
9
+ { }
10
+ else
8
11
relationships || deserialized_params . relationships
9
- )
10
-
12
+ end
13
+
14
+ validation = Serializers ::Validation . new ( record , relationships )
11
15
12
16
render \
13
17
json : { errors : validation . errors } ,
You can’t perform that action at this time.
0 commit comments