Module: MiniDefender::ValidatesInput

Extended by:
ActiveSupport::Concern
Defined in:
lib/mini_defender/validates_input.rb

Instance Method Summary collapse

Instance Method Details

#validate!(rules, coerced = false) ⇒ Object



6
7
8
9
10
11
# File 'lib/mini_defender/validates_input.rb', line 6

def validate!(rules, coerced = false)
  data = cleanse_data(params.to_unsafe_hash.deep_stringify_keys)
  validator = MiniDefender::Validator.new(rules, data)
  validator.validate!
  coerced ? validator.coerced : validator.validated
end