Module: WeakParameters::Controller

Defined in:
lib/weak_parameters/controller.rb

Instance Method Summary collapse

Instance Method Details

#validates(action_name, &block) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/weak_parameters/controller.rb', line 3

def validates(action_name, &block)
  before_filter only: action_name do
    validator = WeakParameters::Validator.new(params, &block)
    WeakParameters.stats[params[:controller]][params[:action]] = validator
    WeakParameters.stats[params[:controller]][params[:action]].validate
  end
end