Commit 35903514 authored by Raphael Sofaer's avatar Raphael Sofaer

remove wasteful join

parent b8609805
......@@ -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')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment