Fix error when favgroup doesn't exist

This commit is contained in:
Toks
2015-06-29 15:15:17 -04:00
parent 9c70b69d28
commit d811aa0b8a

View File

@@ -314,8 +314,10 @@ class PostQueryBuilder
if q[:favgroup].present? if q[:favgroup].present?
favgroup_id = q[:favgroup].to_i favgroup_id = q[:favgroup].to_i
post_ids = FavoriteGroup.find(favgroup_id).post_id_array favgroup = FavoriteGroup.where("favorite_groups.id = ?", favgroup_id).first
relation = relation.where("posts.id in (?)", post_ids) if favgroup
relation = relation.where("posts.id in (?)", favgroup.post_id_array)
end
end end
if q[:ordfav].present? if q[:ordfav].present?