Module: Dry::Rails::Features::SafeParams::ClassMethods

Defined in:
lib/dry/rails/features/safe_params.rb

Overview

ApplicationController methods

Instance Method Summary collapse

Instance Method Details

#schema(*actions, &block) ⇒ self

Define a schema for controller action(s)

Parameters:

  • actions (Array<Symbol>)

Returns:

  • (self)


33
34
35
36
37
38
39
40
41
# File 'lib/dry/rails/features/safe_params.rb', line 33

def schema(*actions, &block)
  schema = Dry::Schema.Params(&block)

  actions.each do |name|
    schemas[name] = schema
  end

  self
end

#schemasObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return registered schemas



46
47
48
# File 'lib/dry/rails/features/safe_params.rb', line 46

def schemas
  @schemas ||= {}
end