From cb13d30a02c9653c32991bd05deca550e58fbbfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Mon, 10 Feb 2014 01:16:14 +0100 Subject: [PATCH] Directly query photos when doing an update_all For some reason it doesn't correctly set the bind variables when called through an association with non-standard keys. Probably a Rails bug. --- app/models/status_message.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/status_message.rb b/app/models/status_message.rb index 7269238c1..0695cdbdf 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -116,14 +116,14 @@ class StatusMessage < Post def update_and_dispatch_attached_photos(sender) if self.photos.any? - self.photos.update_all(:public => self.public) + Photo.where(status_message_guid: guid).update_all(:public => self.public) self.photos.each do |photo| if photo.pending sender.add_to_streams(photo, self.aspects) sender.dispatch_post(photo) end end - self.photos.update_all(:pending => false) + Photo.where(status_message_guid: guid).update_all(:pending => false) end end