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

Revert "reduce db quries on aspects#index"

This reverts commit 3af5e24a.

Conflicts:

	app/controllers/aspects_controller.rb
parent c33a952b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
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