Revert "reduce db quries on aspects#index"
This reverts commit 3af5e24ac6.
Conflicts:
app/controllers/aspects_controller.rb
This commit is contained in:
parent
c33a952bbd
commit
349aa13c05
2 changed files with 2 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue