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