#354: small refactoring

This commit is contained in:
Vokhmin Alexey V 2014-02-18 01:39:49 +04:00
parent 21ac1aef1c
commit 1183f009e3
1 changed files with 1 additions and 1 deletions

View File

@ -247,7 +247,7 @@ class Platform < ActiveRecord::Base
p_ids = Rails.cache.fetch([:availables_main_platforms, user], expires_in: 10.minutes) do p_ids = Rails.cache.fetch([:availables_main_platforms, user], expires_in: 10.minutes) do
ability ||= Ability.new user ability ||= Ability.new user
Platform.main.accessible_by(ability, :show).joins(:repositories). Platform.main.accessible_by(ability, :show).joins(:repositories).
where('repositories.id IS NOT NULL').pluck(:id) where('repositories.id IS NOT NULL').uniq.pluck(:id)
end end
Platform.preload(:repositories).where(id: p_ids).order(:name) Platform.preload(:repositories).where(id: p_ids).order(:name)
end end