Skip to content

Commit

Permalink
Merge pull request #603 from errbit/remove_extra_apps_query
Browse files Browse the repository at this point in the history
Remove extra queries on apps collection
  • Loading branch information
shingara committed Nov 4, 2013
2 parents 39c486a + b0799e0 commit 65b4b30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions app/controllers/apps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AppsController < ApplicationController
}

expose(:apps) {
app_scope.all.sort
app_scope.all.sort.to_a
}

expose(:app, :ancestor => :app_scope)
Expand Down Expand Up @@ -143,4 +143,3 @@ def parse_notice_at_notices_or_set_default
end
end
end

11 changes: 5 additions & 6 deletions app/helpers/apps_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ def link_to_copy_attributes_from_other_app
end

def any_github_repos?
detect_any_apps_with_attributes unless @any_github_repos
detect_any_apps_with_attributes if @any_github_repos.nil?
@any_github_repos
end

def any_notification_services?
detect_any_apps_with_attributes unless @any_notification_services
detect_any_apps_with_attributes if @any_notification_services.present?
@any_notification_services
end

def any_bitbucket_repos?
detect_any_apps_with_attributes unless @any_bitbucket_repos
detect_any_apps_with_attributes if @any_bitbucket_repos.nil?
@any_bitbucket_repos
end

def any_issue_trackers?
detect_any_apps_with_attributes unless @any_issue_trackers
detect_any_apps_with_attributes if @any_issue_trackers.nil?
@any_issue_trackers
end

def any_deploys?
detect_any_apps_with_attributes unless @any_deploys
detect_any_apps_with_attributes if @any_deploys.nil?
@any_deploys
end

Expand All @@ -50,4 +50,3 @@ def detect_any_apps_with_attributes
end
end
end

0 comments on commit 65b4b30

Please sign in to comment.