Class: ActiveSupport::HashWithIndifferentAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/cancan_strong_parameters/controller.rb

Instance Method Summary collapse

Instance Method Details

#standardizedObject

Takes params that are passed in for nested_forms (like the example below) and cleans them up.

post:

comments_attributes: {
  "0" => {,
  "1" => {},  
  "new_23023032" => {}
}

}



191
192
193
194
195
196
197
# File 'lib/cancan_strong_parameters/controller.rb', line 191

def standardized
  ActionController::Parameters.new.tap do |h|
    self.each do |k,v|
      h[k] = v.is_a?(Hash) ? v.to_parameter_array : v
    end
  end
end