diff --git a/app/models/meeting.rb b/app/models/meeting.rb index 41f0a55ecb..264cddf61f 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -69,7 +69,7 @@ class Meeting < ActiveRecord::Base after_initialize :set_initial_values User.before_destroy do |user| - Meeting.update_all ['author_id = ?', DeletedUser.first.id], ['author_id = ?', user.id] + Meeting.where(['author_id = ?', user.id]).update_all ['author_id = ?', DeletedUser.first.id] end def start_date @@ -116,7 +116,7 @@ class Meeting < ActiveRecord::Base changeable_participants = participants.select(&:invited).collect(&:user) changeable_participants = changeable_participants + participants.select(&:attended).collect(&:user) changeable_participants = changeable_participants + \ - project.users.all(include: { memberships: [:roles, :project] }).select { |u| self.visible?(u) } + project.users.includes(memberships: [:roles, :project]).select { |u| self.visible?(u) } changeable_participants.uniq(&:id) end diff --git a/app/models/meeting_content.rb b/app/models/meeting_content.rb index 60d17ab2cc..8319ecbd26 100644 --- a/app/models/meeting_content.rb +++ b/app/models/meeting_content.rb @@ -36,7 +36,7 @@ class MeetingContent < ActiveRecord::Base url: Proc.new { |o| { controller: '/meetings', action: 'show', id: o.meeting } } User.before_destroy do |user| - MeetingContent.update_all ['author_id = ?', DeletedUser.first], ['author_id = ?', user.id] + MeetingContent.where(['author_id = ?', user.id]).update_all ['author_id = ?', DeletedUser.first] end def editable? diff --git a/app/models/meeting_participant.rb b/app/models/meeting_participant.rb index 45de9ff604..726abf39a5 100644 --- a/app/models/meeting_participant.rb +++ b/app/models/meeting_participant.rb @@ -28,7 +28,7 @@ class MeetingParticipant < ActiveRecord::Base attr_accessible :email, :name, :invited, :attended, :user, :user_id, :meeting User.before_destroy do |user| - MeetingParticipant.update_all ['user_id = ?', DeletedUser.first], ['user_id = ?', user.id] + MeetingParticipant.where(['user_id = ?', user.id]).update_all ['user_id = ?', DeletedUser.first] end def name