File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,11 +25,7 @@ def initialize(resource_klass:,
2525 end
2626
2727 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 ) }
3329 end
3430
3531 def relationship_path_string
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ def test_two_relationships_and_field
4040 assert_equal Api ::V1 ::PostResource . _relationship ( :comments ) , path . segments [ 0 ] . relationship
4141 assert_equal Api ::V1 ::CommentResource . _relationship ( :author ) , path . segments [ 1 ] . relationship
4242 assert_equal 'name' , path . segments [ 2 ] . field_name
43+
44+ assert_equal 2 , path . relationship_segments . length
4345 end
4446
4547 def test_two_relationships_and_parse_fields_false_raises_with_field
You can’t perform that action at this time.
0 commit comments