From 31c33f462d92aead29b8feb6445d8fe5626c4963 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang <jp_lang@yahoo.fr>
Date: Mon, 3 Dec 2012 18:21:32 +0000
Subject: Replaces find(:first) calls.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10928 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
 lib/redmine/default_data/loader.rb | 8 ++++----
 lib/tasks/migrate_from_trac.rake   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

(limited to 'lib')

diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb
index 70629e9d3..20ba6eabb 100644
--- a/lib/redmine/default_data/loader.rb
+++ b/lib/redmine/default_data/loader.rb
@@ -26,10 +26,10 @@ module Redmine
         # Returns true if no data is already loaded in the database
         # otherwise false
         def no_data?
-          !Role.find(:first, :conditions => {:builtin => 0}) &&
-            !Tracker.find(:first) &&
-            !IssueStatus.find(:first) &&
-            !Enumeration.find(:first)
+          !Role.where(:builtin => 0).exists? &&
+            !Tracker.exists? &&
+            !IssueStatus.exists? &&
+            !Enumeration.exists?
         end
 
         # Loads the default data
diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake
index 1c7b7bb38..e419775d1 100644
--- a/lib/tasks/migrate_from_trac.rake
+++ b/lib/tasks/migrate_from_trac.rake
@@ -257,7 +257,7 @@ namespace :redmine do
           u.password = 'trac'
           u.admin = true if TracPermission.find_by_username_and_action(username, 'admin')
           # finally, a default user is used if the new user is not valid
-          u = User.find(:first) unless u.save
+          u = User.first unless u.save
         end
         # Make sure he is a member of the project
         if project_member && !u.member_of?(@target_project)
@@ -450,7 +450,7 @@ namespace :redmine do
         puts
 
         # Trac 'resolution' field as a Redmine custom field
-        r = IssueCustomField.find(:first, :conditions => { :name => "Resolution" })
+        r = IssueCustomField.where(:name => "Resolution").first
         r = IssueCustomField.new(:name => 'Resolution',
                                  :field_format => 'list',
                                  :is_filter => true) if r.nil?
-- 
cgit v1.2.3