Method: Grape::DSL::Validations::ClassMethods#reset_validations!

Defined in:
lib/grape/dsl/validations.rb

#reset_validations!Object

Clears all defined parameters and validations. The main purpose of it is to clean up settings, so next endpoint won’t interfere with previous one.

params do
  # params for the endpoint below this block
end
post '/current' do
  # whatever
end

# somewhere between them the reset_validations! method gets called

params do
  # params for the endpoint below this block
end
post '/next' do
  # whatever
end


29
30
31
32
33
# File 'lib/grape/dsl/validations.rb', line 29

def reset_validations!
  unset_namespace_stackable :declared_params
  unset_namespace_stackable :validations
  unset_namespace_stackable :params
end