Revision 1298:4f746d8966dd lib/redmine/default_data

View differences:

lib/redmine/default_data/loader.rb
1 1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
2
# Copyright (C) 2006-2013  Jean-Philippe Lang
3 3
#
4 4
# This program is free software; you can redistribute it and/or
5 5
# modify it under the terms of the GNU General Public License
......
26 26
        # Returns true if no data is already loaded in the database
27 27
        # otherwise false
28 28
        def no_data?
29
          !Role.find(:first, :conditions => {:builtin => 0}) &&
30
            !Tracker.find(:first) &&
31
            !IssueStatus.find(:first) &&
32
            !Enumeration.find(:first)
29
          !Role.where(:builtin => 0).exists? &&
30
            !Tracker.exists? &&
31
            !IssueStatus.exists? &&
32
            !Enumeration.exists?
33 33
        end
34 34

  
35 35
        # Loads the default data
......
139 139
            rejected  = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6)
140 140

  
141 141
            # Workflow
142
            Tracker.find(:all).each { |t|
143
              IssueStatus.find(:all).each { |os|
144
                IssueStatus.find(:all).each { |ns|
142
            Tracker.all.each { |t|
143
              IssueStatus.all.each { |os|
144
                IssueStatus.all.each { |ns|
145 145
                  WorkflowTransition.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
146 146
                }
147 147
              }
148 148
            }
149 149

  
150
            Tracker.find(:all).each { |t|
150
            Tracker.all.each { |t|
151 151
              [new, in_progress, resolved, feedback].each { |os|
152 152
                [in_progress, resolved, feedback, closed].each { |ns|
153 153
                  WorkflowTransition.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
......
155 155
              }
156 156
            }
157 157

  
158
            Tracker.find(:all).each { |t|
158
            Tracker.all.each { |t|
159 159
              [new, in_progress, resolved, feedback].each { |os|
160 160
                [closed].each { |ns|
161 161
                  WorkflowTransition.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns

Also available in: Unified diff