Module: RSchema::RailsInterop::ControllerMethods
- Defined in:
- lib/rschema/rails_interop.rb
Instance Method Summary collapse
Instance Method Details
#params_for_schema!(schema_arg = nil, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rschema/rails_interop.rb', line 6 def params_for_schema!(schema_arg = nil, &block) schema = schema_arg || RSchema.schema(&block) value = self.params coerced, error = RSchema.coerce(schema, value) if error raise ParamSchemaValidationError.new(schema: schema, params: value, error: e) else coerced end end |