File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ def parse_filters(filters)
265265 return @errors . concat ( Exceptions ::FilterNotAllowed . new ( filter_method ) . errors )
266266 end
267267
268- unless @include_directives . include_config ( relationship . name . to_sym ) . present?
268+ unless @include_directives & .include_config ( relationship . name . to_sym ) . present?
269269 return @errors . concat ( Exceptions ::FilterNotAllowed . new ( filter_method ) . errors )
270270 end
271271
Original file line number Diff line number Diff line change @@ -2635,6 +2635,13 @@ def test_show_with_filters_and_included_resources_with_filters
26352635 assert_equal 2 , json_response [ 'included' ] . size
26362636 assert_equal '4' , json_response [ 'included' ] [ 0 ] [ 'id' ]
26372637 end
2638+
2639+ def test_show_with_filters_and_no_included_resources
2640+ get :show , params : { id : 1 , filter : { 'paintings.category' => 'oil' } }
2641+ assert_response :bad_request
2642+ assert_equal ( 'Filter not allowed' , json_response [ 'errors' ] [ 0 ] [ 'title' ] )
2643+ assert_equal ( 'category is not allowed.' , json_response [ 'errors' ] [ 0 ] [ 'detail' ] )
2644+ end
26382645end
26392646
26402647class Api ::V5 ::AuthorsControllerTest < ActionController ::TestCase
You can’t perform that action at this time.
0 commit comments