Skip to content
Extraits de code Groupes Projets
Valider 35903514 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

remove wasteful join

parent b8609805
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -9,9 +9,6 @@ gem 'chef', '0.9.12', :require => false
gem 'nokogiri', '1.4.3.1'
gem "fog", '0.3.25'
gem "excon", "0.2.4"
#Security
gem 'devise', '1.1.3'
gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git', :branch => '0.3.5'
......@@ -43,12 +40,16 @@ gem 'em-websocket', :git => 'git://github.com/igrigorik/em-websocket', :ref => '
#File uploading
gem 'carrierwave', '0.5.2'
gem "fog", '0.3.25'
gem "excon", "0.2.4"
gem 'mini_magick', '3.2'
gem 'aws', '2.3.32' # upgrade to 2.4 breaks 1.8 >.<
gem 'fastercsv', '1.5.4', :require => false
gem 'jammit', '0.5.4'
gem 'rest-client', '1.6.1'
gem 'typhoeus'
#Backups
gem 'cloudfiles', '1.4.10', :require => false
......
......@@ -11,17 +11,17 @@ class PostsController < ApplicationController
def index
if current_user
@posts = StatusMessage.joins(:aspects, :author).where(:pending => false
@posts = StatusMessage.joins(:aspects).where(:pending => false
).where(Aspect.arel_table[:user_id].eq(current_user.id).or(StatusMessage.arel_table[:public].eq(true))
).select('DISTINCT `posts`.*')
else
@posts = StatusMessage.joins(:author).where(:public => true, :pending => false)
@posts = StatusMessage.where(:public => true, :pending => false)
end
if params[:tag]
@posts = @posts.tagged_with(params[:tag])
else
@posts = @posts.where(Person.arel_table[:owner_id].not_eq(nil))
@posts = @posts.joins(:author).where(Person.arel_table[:owner_id].not_eq(nil))
end
@posts = @posts.includes(:comments, :photos).paginate(:page => params[:page], :per_page => 15, :order => 'created_at DESC')
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter