Permalink
Browse files

Use ActiveRecord::Base#exists? instead of first.

  • Loading branch information...
1 parent 6b37fc7 commit 9ecbdafe0e4a0cf2de3c08835214f810ee0e1c32 @ngan committed Aug 10, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/models/role.rb
View
@@ -78,12 +78,12 @@ def unset_no_symlink!
# tells if this role had a successful setup
def setup_done?
- deployed_at_least_once? && self.deployments.first(:conditions => {"deployments.task" => Deployment::SETUP_TASKS, "deployments.status" => Deployment::STATUS_SUCCESS}).present?
+ deployed_at_least_once? && self.deployments.exists?(:conditions => {"deployments.task" => Deployment::SETUP_TASKS, "deployments.status" => Deployment::STATUS_SUCCESS})
end
# tells if this role had a successful deployment (deploy)
def deployed?
- deployed_at_least_once? && self.deployments.first(:conditions => {"deployments.task" => Deployment::DEPLOY_TASKS, "deployments.status" => Deployment::STATUS_SUCCESS}).present?
+ deployed_at_least_once? && self.deployments.exists?(:conditions => {"deployments.task" => Deployment::DEPLOY_TASKS, "deployments.status" => Deployment::STATUS_SUCCESS})
end
# tells if this role had any deployment at all

0 comments on commit 9ecbdaf

Please sign in to comment.