Module: Paramoid::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/paramoid/controller.rb
Instance Method Summary collapse
Instance Method Details
#sanitize_params!(&block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/paramoid/controller.rb', line 7 def sanitize_params!(&block) if block_given? sanitized = Paramoid::Base.new sanitized.instance_exec(_paramoid_safe_current_user, &block) sanitized.sanitize(params) else base_class_name = self.class.name.demodulize.gsub('Controller', '').singularize "#{base_class_name}ParamsSanitizer".safe_constantize&.new(_paramoid_safe_current_user)&.sanitize(params) end end |