##// END OF EJS Templates
Replaces find(:all) calls....
Jean-Philippe Lang -
r10687:5b21efd4a432
parent child
Show More
@@ -23,7 +23,7 class CustomFieldsController < ApplicationController
23 23 before_filter :find_custom_field, :only => [:edit, :update, :destroy]
24 24
25 25 def index
26 @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
26 @custom_fields_by_type = CustomField.all.group_by {|f| f.class.name }
27 27 @tab = params[:tab] || 'IssueCustomField'
28 28 end
29 29
@@ -43,7 +43,7 class DocumentsController < ApplicationController
43 43 end
44 44
45 45 def show
46 @attachments = @document.attachments.find(:all, :order => "created_on DESC")
46 @attachments = @document.attachments.all
47 47 end
48 48
49 49 def new
@@ -40,10 +40,12 class MessagesController < ApplicationController
40 40
41 41 @reply_count = @topic.children.count
42 42 @reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page
43 @replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}],
44 :order => "#{Message.table_name}.created_on ASC",
45 :limit => @reply_pages.items_per_page,
46 :offset => @reply_pages.current.offset)
43 @replies = @topic.children.
44 includes(:author, :attachments, {:board => :project}).
45 reorder("#{Message.table_name}.created_on ASC").
46 limit(@reply_pages.items_per_page).
47 offset(@reply_pages.current.offset).
48 all
47 49
48 50 @reply = Message.new(:subject => "RE: #{@message.subject}")
49 51 render :action => "show", :layout => false if request.xhr?
@@ -57,11 +57,10 class ProjectsController < ApplicationController
57 57 format.api {
58 58 @offset, @limit = api_offset_and_limit
59 59 @project_count = Project.visible.count
60 @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft')
60 @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
61 61 }
62 62 format.atom {
63 projects = Project.visible.find(:all, :order => 'created_on DESC',
64 :limit => Setting.feeds_limit.to_i)
63 projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
65 64 render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
66 65 }
67 66 end
@@ -145,7 +144,7 class ProjectsController < ApplicationController
145 144
146 145 @users_by_role = @project.users_by_role
147 146 @subprojects = @project.children.visible.all
148 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
147 @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
149 148 @trackers = @project.rolled_up_trackers
150 149
151 150 cond = @project.project_condition(Setting.display_subprojects_issues?)
@@ -90,6 +90,6 class ReportsController < ApplicationController
90 90 private
91 91
92 92 def find_issue_statuses
93 @statuses = IssueStatus.find(:all, :order => 'position')
93 @statuses = IssueStatus.sorted.all
94 94 end
95 95 end
@@ -141,10 +141,11 class RepositoriesController < ApplicationController
141 141 @changeset_pages = Paginator.new self, @changeset_count,
142 142 per_page_option,
143 143 params['page']
144 @changesets = @repository.changesets.find(:all,
145 :limit => @changeset_pages.items_per_page,
146 :offset => @changeset_pages.current.offset,
147 :include => [:user, :repository, :parents])
144 @changesets = @repository.changesets.
145 limit(@changeset_pages.items_per_page).
146 offset(@changeset_pages.current.offset).
147 includes(:user, :repository, :parents).
148 all
148 149
149 150 respond_to do |format|
150 151 format.html { render :layout => false if request.xhr? }
@@ -37,7 +37,7 class TrackersController < ApplicationController
37 37 def new
38 38 @tracker ||= Tracker.new(params[:tracker])
39 39 @trackers = Tracker.find :all, :order => 'position'
40 @projects = Project.find(:all)
40 @projects = Project.all
41 41 end
42 42
43 43 def create
@@ -57,7 +57,7 class TrackersController < ApplicationController
57 57
58 58 def edit
59 59 @tracker ||= Tracker.find(params[:id])
60 @projects = Project.find(:all)
60 @projects = Project.all
61 61 end
62 62
63 63 def update
@@ -83,7 +83,7 class UsersController < ApplicationController
83 83
84 84 def new
85 85 @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
86 @auth_sources = AuthSource.find(:all)
86 @auth_sources = AuthSource.all
87 87 end
88 88
89 89 def create
@@ -112,7 +112,7 class UsersController < ApplicationController
112 112 format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
113 113 end
114 114 else
115 @auth_sources = AuthSource.find(:all)
115 @auth_sources = AuthSource.all
116 116 # Clear password input
117 117 @user.password = @user.password_confirmation = nil
118 118
@@ -124,7 +124,7 class UsersController < ApplicationController
124 124 end
125 125
126 126 def edit
127 @auth_sources = AuthSource.find(:all)
127 @auth_sources = AuthSource.all
128 128 @membership ||= Member.new
129 129 end
130 130
@@ -159,7 +159,7 class UsersController < ApplicationController
159 159 format.api { render_api_ok }
160 160 end
161 161 else
162 @auth_sources = AuthSource.find(:all)
162 @auth_sources = AuthSource.all
163 163 @membership ||= Member.new
164 164 # Clear password input
165 165 @user.password = @user.password_confirmation = nil
@@ -31,7 +31,7 class VersionsController < ApplicationController
31 31 def index
32 32 respond_to do |format|
33 33 format.html {
34 @trackers = @project.trackers.find(:all, :order => 'position')
34 @trackers = @project.trackers.sorted.all
35 35 retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?})
36 36 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
37 37 project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id]
@@ -64,9 +64,10 class VersionsController < ApplicationController
64 64 def show
65 65 respond_to do |format|
66 66 format.html {
67 @issues = @version.fixed_issues.visible.find(:all,
68 :include => [:status, :tracker, :priority],
69 :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id")
67 @issues = @version.fixed_issues.visible.
68 includes(:status, :tracker, :priority).
69 reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
70 all
70 71 }
71 72 format.api
72 73 end
@@ -64,7 +64,7 class WatchersController < ApplicationController
64 64 end
65 65
66 66 def autocomplete_for_user
67 @users = User.active.like(params[:q]).find(:all, :limit => 100)
67 @users = User.active.like(params[:q]).limit(100).all
68 68 if @watched
69 69 @users -= @watched.watcher_users
70 70 end
General Comments 0
You need to be logged in to leave comments. Login now