Skip to content
Browse files

Prevent duplicates in previous entities core profile field

  • Loading branch information...
1 parent df1000b commit 5e917c4b81a00fdca6d679f56c7b33db5417a51e Jesse Stuart committed Nov 16, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/tentd/model/profile_info.rb
View
2 lib/tentd/model/profile_info.rb
@@ -50,7 +50,7 @@ def self.update_profile(type, data)
infos.to_a.each(&:destroy)
info.old_entity = (info.content || {})['entity']
info.entity_changed = true if type.base == TENT_PROFILE_TYPE.base && data.find { |k,v| k.to_s == 'entity' && v != info.old_entity }
- data['previous_entities'] = (data['previous_entities'] || []).unshift(info.old_entity) if info.entity_changed
+ data['previous_entities'] = (data['previous_entities'] || []).unshift(info.old_entity).uniq if info.entity_changed
info.type = type
info.content = data
info.save

0 comments on commit 5e917c4

Please sign in to comment.
Something went wrong with that request. Please try again.