#354: small refactoring
This commit is contained in:
parent
21ac1aef1c
commit
1183f009e3
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue