Commit 65b4b305aed110ba20a159702cabd3f312a3ba9a
Exists in
master
and in
1 other branch
Merge pull request #603 from errbit/remove_extra_apps_query
Remove extra queries on apps collection
Showing
2 changed files
with
6 additions
and
8 deletions
Show diff stats
app/controllers/apps_controller.rb
@@ -12,7 +12,7 @@ class AppsController < ApplicationController | @@ -12,7 +12,7 @@ class AppsController < ApplicationController | ||
12 | } | 12 | } |
13 | 13 | ||
14 | expose(:apps) { | 14 | expose(:apps) { |
15 | - app_scope.all.sort | 15 | + app_scope.all.sort.to_a |
16 | } | 16 | } |
17 | 17 | ||
18 | expose(:app, :ancestor => :app_scope) | 18 | expose(:app, :ancestor => :app_scope) |
@@ -143,4 +143,3 @@ class AppsController < ApplicationController | @@ -143,4 +143,3 @@ class AppsController < ApplicationController | ||
143 | end | 143 | end |
144 | end | 144 | end |
145 | end | 145 | end |
146 | - |
app/helpers/apps_helper.rb
@@ -12,27 +12,27 @@ module AppsHelper | @@ -12,27 +12,27 @@ module AppsHelper | ||
12 | end | 12 | end |
13 | 13 | ||
14 | def any_github_repos? | 14 | def any_github_repos? |
15 | - detect_any_apps_with_attributes unless @any_github_repos | 15 | + detect_any_apps_with_attributes if @any_github_repos.nil? |
16 | @any_github_repos | 16 | @any_github_repos |
17 | end | 17 | end |
18 | 18 | ||
19 | def any_notification_services? | 19 | def any_notification_services? |
20 | - detect_any_apps_with_attributes unless @any_notification_services | 20 | + detect_any_apps_with_attributes if @any_notification_services.present? |
21 | @any_notification_services | 21 | @any_notification_services |
22 | end | 22 | end |
23 | 23 | ||
24 | def any_bitbucket_repos? | 24 | def any_bitbucket_repos? |
25 | - detect_any_apps_with_attributes unless @any_bitbucket_repos | 25 | + detect_any_apps_with_attributes if @any_bitbucket_repos.nil? |
26 | @any_bitbucket_repos | 26 | @any_bitbucket_repos |
27 | end | 27 | end |
28 | 28 | ||
29 | def any_issue_trackers? | 29 | def any_issue_trackers? |
30 | - detect_any_apps_with_attributes unless @any_issue_trackers | 30 | + detect_any_apps_with_attributes if @any_issue_trackers.nil? |
31 | @any_issue_trackers | 31 | @any_issue_trackers |
32 | end | 32 | end |
33 | 33 | ||
34 | def any_deploys? | 34 | def any_deploys? |
35 | - detect_any_apps_with_attributes unless @any_deploys | 35 | + detect_any_apps_with_attributes if @any_deploys.nil? |
36 | @any_deploys | 36 | @any_deploys |
37 | end | 37 | end |
38 | 38 | ||
@@ -50,4 +50,3 @@ module AppsHelper | @@ -50,4 +50,3 @@ module AppsHelper | ||
50 | end | 50 | end |
51 | end | 51 | end |
52 | end | 52 | end |
53 | - |