Revert "reduce db quries on aspects#index"

This reverts commit 3af5e24ac6.

Conflicts:

	app/controllers/aspects_controller.rb
This commit is contained in:
Raphael Sofaer 2011-03-28 14:59:16 -07:00
parent c33a952bbd
commit 349aa13c05
2 changed files with 2 additions and 10 deletions

View file

@ -21,13 +21,13 @@ module ApplicationHelper
def aspects_with_post aspects, post
aspects.select do |aspect|
aspect.has_post?(post)
PostVisibility.exists?(:aspect_id => aspect.id, :post_id => post.id)
end
end
def aspects_without_post aspects, post
aspects.reject do |aspect|
aspect.has_post?(post)
PostVisibility.exists?(:aspect_id => aspect.id, :post_id => post.id)
end
end

View file

@ -21,14 +21,6 @@ class Aspect < ActiveRecord::Base
name.strip!
end
def has_post? post
post_ids = post_visibilities.each { |pv| pv.post_id }
post_ids.each { |id|
return true if id == post.id
}
return false
end
def to_s
name
end