diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index 96f2518bb..fb03277a7 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -23,7 +23,7 @@ class CustomFieldsController < ApplicationController before_filter :find_custom_field, :only => [:edit, :update, :destroy] def index - @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name } + @custom_fields_by_type = CustomField.all.group_by {|f| f.class.name } @tab = params[:tab] || 'IssueCustomField' end diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index b3c82eeb0..979fc6004 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -43,7 +43,7 @@ class DocumentsController < ApplicationController end def show - @attachments = @document.attachments.find(:all, :order => "created_on DESC") + @attachments = @document.attachments.all end def new diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index d4c388c22..16e3b7c45 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -40,10 +40,12 @@ class MessagesController < ApplicationController @reply_count = @topic.children.count @reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page - @replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}], - :order => "#{Message.table_name}.created_on ASC", - :limit => @reply_pages.items_per_page, - :offset => @reply_pages.current.offset) + @replies = @topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on ASC"). + limit(@reply_pages.items_per_page). + offset(@reply_pages.current.offset). + all @reply = Message.new(:subject => "RE: #{@message.subject}") render :action => "show", :layout => false if request.xhr? diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3c1e6ba0a..c8222db73 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -57,11 +57,10 @@ class ProjectsController < ApplicationController format.api { @offset, @limit = api_offset_and_limit @project_count = Project.visible.count - @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft') + @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all } format.atom { - projects = Project.visible.find(:all, :order => 'created_on DESC', - :limit => Setting.feeds_limit.to_i) + projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") } end @@ -145,7 +144,7 @@ class ProjectsController < ApplicationController @users_by_role = @project.users_by_role @subprojects = @project.children.visible.all - @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") + @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all @trackers = @project.rolled_up_trackers cond = @project.project_condition(Setting.display_subprojects_issues?) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index c9e9a39fa..7b8e37aee 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -90,6 +90,6 @@ class ReportsController < ApplicationController private def find_issue_statuses - @statuses = IssueStatus.find(:all, :order => 'position') + @statuses = IssueStatus.sorted.all end end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 0a453a07c..5f5eb5e6f 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -141,10 +141,11 @@ class RepositoriesController < ApplicationController @changeset_pages = Paginator.new self, @changeset_count, per_page_option, params['page'] - @changesets = @repository.changesets.find(:all, - :limit => @changeset_pages.items_per_page, - :offset => @changeset_pages.current.offset, - :include => [:user, :repository, :parents]) + @changesets = @repository.changesets. + limit(@changeset_pages.items_per_page). + offset(@changeset_pages.current.offset). + includes(:user, :repository, :parents). + all respond_to do |format| format.html { render :layout => false if request.xhr? } diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 02f91eaab..3c08e30a7 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -37,7 +37,7 @@ class TrackersController < ApplicationController def new @tracker ||= Tracker.new(params[:tracker]) @trackers = Tracker.find :all, :order => 'position' - @projects = Project.find(:all) + @projects = Project.all end def create @@ -57,7 +57,7 @@ class TrackersController < ApplicationController def edit @tracker ||= Tracker.find(params[:id]) - @projects = Project.find(:all) + @projects = Project.all end def update diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index da6f6ae28..239bd290e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -83,7 +83,7 @@ class UsersController < ApplicationController def new @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all end def create @@ -112,7 +112,7 @@ class UsersController < ApplicationController format.api { render :action => 'show', :status => :created, :location => user_url(@user) } end else - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all # Clear password input @user.password = @user.password_confirmation = nil @@ -124,7 +124,7 @@ class UsersController < ApplicationController end def edit - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all @membership ||= Member.new end @@ -159,7 +159,7 @@ class UsersController < ApplicationController format.api { render_api_ok } end else - @auth_sources = AuthSource.find(:all) + @auth_sources = AuthSource.all @membership ||= Member.new # Clear password input @user.password = @user.password_confirmation = nil diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 852f7a590..9777c0537 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -31,7 +31,7 @@ class VersionsController < ApplicationController def index respond_to do |format| format.html { - @trackers = @project.trackers.find(:all, :order => 'position') + @trackers = @project.trackers.sorted.all retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?}) @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id] @@ -64,9 +64,10 @@ class VersionsController < ApplicationController def show respond_to do |format| format.html { - @issues = @version.fixed_issues.visible.find(:all, - :include => [:status, :tracker, :priority], - :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") + @issues = @version.fixed_issues.visible. + includes(:status, :tracker, :priority). + reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id"). + all } format.api end diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index a0be20faf..278ca1bc5 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -64,7 +64,7 @@ class WatchersController < ApplicationController end def autocomplete_for_user - @users = User.active.like(params[:q]).find(:all, :limit => 100) + @users = User.active.like(params[:q]).limit(100).all if @watched @users -= @watched.watcher_users end