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

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

Overview

SafeParams controller feature

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

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.



13
14
15
16
17
18
19
20
# File 'lib/dry/rails/features/safe_params.rb', line 13

def self.included(klass)
  super
  klass.extend(ClassMethods)

  klass.class_eval do
    before_action(:set_safe_params, prepend: true)
  end
end

Instance Method Details

#safe_paramsDry::Schema::Result

Return schema result

Returns:

  • (Dry::Schema::Result)


56
57
58
# File 'lib/dry/rails/features/safe_params.rb', line 56

def safe_params
  @safe_params
end

#schemasHash<Symbol => Dry::Schema::Params]

Return registered action schemas

Returns:

  • (Hash<Symbol => Dry::Schema::Params])

    Hash<Symbol => Dry::Schema::Params]



65
66
67
# File 'lib/dry/rails/features/safe_params.rb', line 65

def schemas
  self.class.schemas
end