lib/active_ldap/persistence.rb in activeldap-3.1.1 vs lib/active_ldap/persistence.rb in activeldap-3.2.0

- old
+ new

@@ -70,7 +70,24 @@ new_superior) end true end end + + def reload + clear_association_cache + _, attributes = search(:value => id).find do |_dn, _attributes| + dn == _dn + end + if attributes.nil? + raise EntryNotFound, _("Can't find DN '%s' to reload") % dn + end + + @ldap_data.update(attributes) + classes, attributes = extract_object_class(attributes) + self.classes = classes + self.attributes = attributes + @new_entry = false + self + end end # Persistence end # ActiveLdap