diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 64a3d15e4..ca2d7e4b1 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -11,7 +11,7 @@ class AspectsController < ApplicationController def index if params[:a_ids] - @aspects = current_user.aspects.where(:id => params[:a_ids]).includes(:contacts) #linit 16 + @aspects = current_user.aspects.where(:id => params[:a_ids]).includes(:contacts) else @aspects = current_user.aspects.includes(:contacts) end @@ -25,7 +25,7 @@ class AspectsController < ApplicationController post_ids = @aspects.map{|a| a.post_ids}.flatten! @posts = StatusMessage.joins(:aspects).where(:pending => false, - :aspects => {:id => @aspect_ids}).includes(:person, :comments, :photos).select('DISTINCT `posts`.*').paginate( + :aspects => {:id => @aspect_ids}).includes(:person, :comments => :person, :photos).select('DISTINCT `posts`.*').paginate( :page => params[:page], :per_page => 15, :order => 'created_at DESC') @contacts = current_user.contacts.includes(:person).where(:pending => false) @@ -70,13 +70,13 @@ class AspectsController < ApplicationController end def show - @aspect = current_user.aspects.where(:id => params[:id]).first + @aspect = current_user.aspects.where(:id => params[:id]).includes(:contacts => :person).first redirect_to aspects_path('a_ids[]' => @aspect.id) end def edit - @aspect = current_user.aspects.where(:id => params[:id]).includes(:contacts).first - @contacts = current_user.contacts.where(:pending => false) + @aspect = current_user.aspects.where(:id => params[:id]).first + @contacts = current_user.contacts.includes(:person).where(:pending => false) unless @aspect render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else @@ -88,9 +88,9 @@ class AspectsController < ApplicationController def manage @aspect = :manage - @contacts = current_user.contacts.where(:pending => false) + @contacts = current_user.contacts.includes(:person).where(:pending => false) @remote_requests = Request.where(:recipient_id => current_user.person.id) - @aspects = @all_aspects.includes(:contacts) + @aspects = @all_aspects.includes(:contacts => :person) end def update diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 2b0f9ed38..7bc451d0c 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -135,7 +135,7 @@ class PhotosController < ApplicationController end def show - @photo = current_user.visible_photos.where(:id => params[:id]).first + @photo = current_user.visible_photos.where(:id => params[:id]).includes(:person, :status_message => :photos).first if @photo @parent = @photo.status_message @@ -152,8 +152,8 @@ class PhotosController < ApplicationController end @object_aspect_ids = [] - if @parent.aspects - @object_aspect_ids = @parent.aspects.map{|a| a.id} + if @parent_aspects = @parent.aspects.where(:user_id => current_user.id) + @object_aspect_ids = @parent_aspects.map{|a| a.id} end @ownership = current_user.owns? @photo diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index caa3a934a..aaf7a66ac 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -9,7 +9,7 @@ class PostsController < ApplicationController skip_before_filter :set_locale def show - @post = Post.where(:id => params[:id], :public => true).first + @post = Post.where(:id => params[:id], :public => true).includes(:person, :comments => :person).first if @post @landing_page = true diff --git a/app/models/comment.rb b/app/models/comment.rb index 8b5816abf..10027719b 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -3,7 +3,6 @@ # the COPYRIGHT file. class Comment < ActiveRecord::Base - default_scope :include => :person require File.join(Rails.root, 'lib/diaspora/web_socket') require File.join(Rails.root, 'lib/youtube_titles') include YoutubeTitles diff --git a/app/models/contact.rb b/app/models/contact.rb index 366fe898c..71b5f638f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -3,7 +3,6 @@ # the COPYRIGHT file. class Contact < ActiveRecord::Base - default_scope :include => :person belongs_to :user validates_presence_of :user diff --git a/app/models/post.rb b/app/models/post.rb index 48f8f9a1d..456fce36e 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -3,7 +3,6 @@ # the COPYRIGHT file. class Post < ActiveRecord::Base - default_scope :include => [:person, :comments] require File.join(Rails.root, 'lib/encryptable') require File.join(Rails.root, 'lib/diaspora/web_socket') include ApplicationHelper