rschema 2.4.0 → 3.0.1.pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +0,0 @@
1
- module RSchema
2
- module RailsInterop
3
- ParamSchemaValidationError = Class.new(StandardError)
4
-
5
- module ControllerMethods
6
- def params_for_schema!(schema_arg = nil, &block)
7
- schema = schema_arg || RSchema.schema(&block)
8
- value = self.params
9
- coerced, error = RSchema.coerce(schema, value)
10
- if error
11
- raise ParamSchemaValidationError.new(schema: schema, params: value, error: e)
12
- else
13
- coerced
14
- end
15
- end
16
- end
17
-
18
- end
19
- end