File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,7 @@ def initialize(resource_klass:,
25
25
end
26
26
27
27
def relationship_segments
28
- relationships = [ ]
29
- @segments . each do |segment |
30
- relationships << segment if segment . is_a? ( PathSegment ::Relationship )
31
- end
32
- relationships
28
+ @segments . select { |p | p . is_a? ( PathSegment ::Relationship ) }
33
29
end
34
30
35
31
def relationship_path_string
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ def test_two_relationships_and_field
40
40
assert_equal Api ::V1 ::PostResource . _relationship ( :comments ) , path . segments [ 0 ] . relationship
41
41
assert_equal Api ::V1 ::CommentResource . _relationship ( :author ) , path . segments [ 1 ] . relationship
42
42
assert_equal 'name' , path . segments [ 2 ] . field_name
43
+
44
+ assert_equal 2 , path . relationship_segments . length
43
45
end
44
46
45
47
def test_two_relationships_and_parse_fields_false_raises_with_field
You can’t perform that action at this time.
0 commit comments