Method: ActiveLdap::Base#attributes=

Defined in:
lib/active_ldap/base.rb

#attributes=(new_attributes) ⇒ Object

This allows a bulk update to the attributes of a record without forcing an immediate save or validation.

It is unwise to attempt objectClass updates this way. Also be sure to only pass in key-value pairs of your choosing. Do not let URL/form hackers supply the keys.



915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
# File 'lib/active_ldap/base.rb', line 915

def attributes=(new_attributes)
  return if new_attributes.blank?
  _schema = _local_entry_attribute = nil
  targets = remove_attributes_protected_from_mass_assignment(new_attributes)
  targets.each do |key, value|
    setter = "#{key}="
    unless respond_to?(setter)
      _schema ||= schema
      attribute = _schema.attribute(key)
      next if attribute.id.nil?
      _local_entry_attribute ||= local_entry_attribute
      _local_entry_attribute.register(attribute)
    end
    send(setter, value)
  end
end