def update_record_from_params(parent_record, columns, attributes, avoid_changes = false)
      crud_type = parent_record.new_record? ? :create : :update
      return parent_record unless parent_record.authorized_for?(:crud_type => crud_type)

      multi_parameter_attrs = multi_parameter_attributes(attributes)

      columns.each_column(for: parent_record, crud_type: crud_type, flatten: true) do |column|
        begin
          # Set any passthrough parameters that may be associated with this column (ie, file column "keep" and "temp" attributes)
          column.params.select { |p| attributes.key? p }.each { |p| parent_record.send("#{p}=", attributes[p]) }

          if multi_parameter_attrs.key? column.name.to_s
            parent_record.send(:assign_multiparameter_attributes, multi_parameter_attrs[column.name.to_s])
          elsif attributes.key? column.name
            update_column_from_params(parent_record, column, attributes[column.name], avoid_changes)
          end
        rescue StandardError => e
          message = "on the ActiveScaffold column = :#{column.name} for #{parent_record.inspect} "\
                    "(value from params #{attributes[column.name].inspect})"
          Rails.logger.error "#{e.class.name}: #{e.message} -- #{message}"
          raise
        end
      end

      parent_record
    end
def update_record_from_params(parent_record, columns, attributes, avoid_changes = false)
      crud_type = parent_record.new_record? ? :create : :update
      return parent_record unless parent_record.authorized_for?(:crud_type => crud_type)

      multi_parameter_attrs = multi_parameter_attributes(attributes)

      columns.each_column(for: parent_record, crud_type: crud_type, flatten: true) do |column|
        begin
          # Set any passthrough parameters that may be associated with this column (ie, file column "keep" and "temp" attributes)
          column.params.select { |p| attributes.key? p }.each { |p| parent_record.send("#{p}=", attributes[p]) }

          if multi_parameter_attrs.key? column.name.to_s
            parent_record.send(:assign_multiparameter_attributes, multi_parameter_attrs[column.name.to_s])
          elsif attributes.key? column.name
            update_column_from_params(parent_record, column, attributes[column.name], avoid_changes)
          end
        rescue StandardError => e
          message = "on the ActiveScaffold column = :#{column.name} for #{parent_record.inspect} "\
                    "(value from params #{attributes[column.name].inspect})"
          Rails.logger.error "#{e.class.name}: #{e.message} -- #{message}"
          raise
        end
      end

      parent_record
    end
Takes attributes (as from params[:record]) and applies them to the parent_record. Also looks for
 association attributes and attempts to instantiate them as associated objects.

 This is a secure way to apply params to a record, because it's based on a loop over the columns
 set. The columns set will not yield unauthorized columns, and it will not yield unregistered columns.