File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1156,6 +1156,21 @@ is raised and can be rescued and processed. It contains a description
11561156of the parameter value expectations. Validations can be turned off
11571157in the configuration file.
11581158
1159+ Here is an example of how to rescue and process a +ParamMissing+ or
1160+ +ParamInvalid+ error from within the ApplicationController.
1161+
1162+ .. code :: ruby
1163+
1164+ class ApplicationController < ActionController ::Base
1165+
1166+ # ParamError is superclass of ParamMissing, ParamInvalid
1167+ rescue_from Apipie ::ParamError do |e |
1168+ render text: e.message, status: :unprocessable_entity
1169+ end
1170+
1171+ # ...
1172+ end
1173+
11591174 Parameter validation normally happens after before_actions, just before
11601175your controller method is invoked. If you prefer to control when parameter
11611176validation occurs, set the configuration parameter ``validate `` to ``:explicitly ``.
You can’t perform that action at this time.
0 commit comments