MS DG; only select the ids for soup query

This commit is contained in:
Maxwell Salzberg 2011-10-14 11:08:47 -07:00
parent 0ce7f0c4bf
commit 14c5f1c564
2 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,7 @@ require File.join(Rails.root, 'lib', 'stream', 'soup')
class SoupsController < ApplicationController class SoupsController < ApplicationController
before_filter :redirect_unless_admin before_filter :redirect_unless_admin
def index def index
default_stream_action(Stream::Soup) default_stream_action(Stream::Soup)
end end
end end

View file

@ -24,7 +24,7 @@ class Stream::Soup < Stream::Base
end end
def followed_tag_ids def followed_tag_ids
StatusMessage.tag_stream(user, tag_array, max_time, order).map{|x| x.id} ids(StatusMessage.tag_stream(user, tag_array, max_time, order))
end end
def mentioned_post_ids def mentioned_post_ids
@ -37,14 +37,14 @@ class Stream::Soup < Stream::Base
#worthless helpers #worthless helpers
def featured_user_ids def featured_user_ids
ids(Person.featured_users) Person.featured_users.select('id').map{|x| x.id}
end end
def tag_array def tag_array
user.followed_tags.map{|x| x.name} user.followed_tags.select('name').map{|x| x.name}
end end
def ids(enumerable) def ids(enumerable)
enumerable.map{|x| x.id} Post.connection.select_values(enumerable.select('posts.id').to_sql)
end end
end end