lib/pupa/models/organization.rb in pupa-0.0.13 vs lib/pupa/models/organization.rb in pupa-0.1.0
- old
+ new
@@ -31,14 +31,18 @@
# @todo Parentless organizations in different jurisdictions can have the
# same name. Add a `jurisdiction` property?
def fingerprint
hash = super.slice(:classification, :parent_id)
- {
- '$or' => [
- hash.merge('name' => name),
- hash.merge('other_names.name' => name),
- ],
- }
+ if name
+ {
+ '$or' => [
+ hash.merge('name' => name),
+ hash.merge('other_names.name' => name),
+ ],
+ }
+ else
+ hash
+ end
end
end
end