File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ def parse_filters(filters)
265
265
return @errors . concat ( Exceptions ::FilterNotAllowed . new ( filter_method ) . errors )
266
266
end
267
267
268
- unless @include_directives . include_config ( relationship . name . to_sym ) . present?
268
+ unless @include_directives & .include_config ( relationship . name . to_sym ) . present?
269
269
return @errors . concat ( Exceptions ::FilterNotAllowed . new ( filter_method ) . errors )
270
270
end
271
271
Original file line number Diff line number Diff line change @@ -2635,6 +2635,13 @@ def test_show_with_filters_and_included_resources_with_filters
2635
2635
assert_equal 2 , json_response [ 'included' ] . size
2636
2636
assert_equal '4' , json_response [ 'included' ] [ 0 ] [ 'id' ]
2637
2637
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
2638
2645
end
2639
2646
2640
2647
class Api ::V5 ::AuthorsControllerTest < ActionController ::TestCase
You can’t perform that action at this time.
0 commit comments