Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
Use where clause instead of first_or_create_by
app/models/profile.rb | 3 +++
diff --git a/app/models/profile.rb b/app/models/profile.rb index cf7b3d05bb20f428e9e331ff719605fa0f51d667..7b8ca521d7f1070f72ad3bfac7908cc530321f3b 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -855,6 +855,9 @@ # adds a person as administrator os this profile def add_admin(person) self.affiliate(person, Profile::Roles.admin(environment.id)) + # FIXME: fix find_or_create_by on code below + # circle = Circle.find_or_create_by(name: _('memberships'), profile_type: self.class.name, person: person) + # person.follow(self, circle) circle = Circle.where(name: _('memberships'), profile_type: self.class.name, person: person).first person.follow(self, circle) if circle end